-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- added: EEPROM support - added: macro STM32CUBEDUINO_DISABLE_EEPROM - added: macro STM32CUBEDUINO_DISABLE_PRINTF_FLOAT - added: macro STM32CUBEDUINO_DISABLE_SCANF_FLOAT - added: macro STM32CUBEDUINO_DISABLE_STRING - added: hints for possible flash and speed improvement options to FAQ - added: STM32L053C8T6 (GreenPill) blinky example - fixed: OpenOCD target name creation in BuildScript.py for STM32L0, STM32L1 and STM32W108 - fixed: missing transfer flag handling in USB_Send() Signed-off-by: Daniel Starke <[email protected]>
- Loading branch information
1 parent
d447a03
commit 28c5c30
Showing
21 changed files
with
987 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"build": { | ||
"core": "stm32", | ||
"cpu": "cortex-m0plus", | ||
"mcu": "stm32l053c8t6", | ||
"product_line": "STM32L053xx", | ||
"extra_flags": "-DUSB_VID=0x2341 -DUSB_PID=0x8036" | ||
}, | ||
"debug": { | ||
"default_tools": [ | ||
"stlink" | ||
], | ||
"jlink_device": "STM32L053C8", | ||
"onboard_tools": [ | ||
"stlink" | ||
], | ||
"openocd_target": "stm32l0", | ||
"svd_path": "STM32L053x.svd" | ||
}, | ||
"frameworks": "stm32cube", | ||
"name": "greenpill", | ||
"upload": { | ||
"maximum_ram_size": 8192, | ||
"maximum_size": 65536, | ||
"protocol": "stlink", | ||
"protocols": [ | ||
"jlink", | ||
"stlink", | ||
"blackmagic", | ||
"serial", | ||
"mbed", | ||
"dfu" | ||
] | ||
}, | ||
"url": "https://stm32-base.org/boards/STM32L053C8T6-Green-Pill", | ||
"vendor": "Generic" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[platformio] | ||
workspace_dir = bin | ||
src_dir = src | ||
lib_dir = ../../../.. | ||
|
||
[common] | ||
build_flags = -Wall -Wextra -Wformat -pedantic -Wshadow -Wconversion -Wparentheses -Wunused -Wno-missing-field-initializers | ||
|
||
[env:greenpill] | ||
platform = ststm32 | ||
platform_packages = [email protected] | ||
framework = stm32cube | ||
board = greenpill | ||
build_flags = -fno-strict-aliasing -I${PROJECTSRC_DIR}/greenpill -DNO_GPL | ||
src_build_flags = ${common.build_flags} | ||
debug_tool = stlink |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* @file board.cpp | ||
* @author Daniel Starke | ||
* @copyright Copyright 2022 Daniel Starke | ||
* @date 2022-05-29 | ||
* @version 2022-05-29 | ||
*/ | ||
#include <Arduino.h> | ||
#include <wiring_irq.h> | ||
|
||
|
||
/* exported variables */ | ||
HardwareSerial Serial1(USART1, getIrqNumFor(USART1), PA_10, PA_9, 4, 4); | ||
|
||
|
||
/** | ||
* Initializes this board by configuring the system clock base. | ||
*/ | ||
void initVariant() { | ||
RCC_OscInitTypeDef RCC_OscInitStruct = {0}; | ||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; | ||
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; | ||
|
||
/* Configure the main internal regulator output voltage */ | ||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); | ||
/* Initializes the RCC Oscillators according to the specified parameters in the RCC_OscInitTypeDef structure. */ | ||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; | ||
RCC_OscInitStruct.HSEState = RCC_HSE_ON; | ||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; | ||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; | ||
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLLMUL_12; | ||
RCC_OscInitStruct.PLL.PLLDIV = RCC_PLLDIV_3; | ||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { | ||
systemErrorHandler(); | ||
} | ||
/* Initializes the CPU, AHB and APB buses clocks */ | ||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; | ||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; | ||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; | ||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; | ||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; | ||
|
||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) { | ||
systemErrorHandler(); | ||
} | ||
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_USB; | ||
PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2; | ||
PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_PLL; | ||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { | ||
systemErrorHandler(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* @file board.hpp | ||
* @author Daniel Starke | ||
* @copyright Copyright 2022 Daniel Starke | ||
* @date 2022-05-29 | ||
* @version 2022-05-29 | ||
*/ | ||
#ifndef __GREENPILL_HPP__ | ||
#define __GREENPILL_HPP__ | ||
|
||
#include <stdint.h> | ||
#include <stm32l0xx.h> | ||
#include <stm32l0xx_hal.h> | ||
#include <stm32l0xx_ll_cortex.h> | ||
#include <stm32l0xx_ll_exti.h> | ||
#include <stm32l0xx_ll_gpio.h> | ||
#include <stm32l0xx_ll_system.h> | ||
#include <stm32l0xx_ll_tim.h> | ||
|
||
|
||
#ifndef __STM32L053xx_H | ||
#error Missing include of stm32l053xx.h. Please define STM32L053xx. | ||
#endif | ||
|
||
|
||
#define USB_IRQ_PRIO 0 | ||
#define USB_IRQ_SUBPRIO 0 | ||
|
||
#define UART_IRQ_PRIO 1 | ||
#define UART_IRQ_SUBPRIO 0 | ||
|
||
#define EXTI_IRQ_PRIO 3 | ||
#define EXTI_IRQ_SUBPRIO 0 | ||
|
||
#define TIMER_IRQ_PRIO 4 | ||
#define TIMER_IRQ_SUBPRIO 0 | ||
|
||
#define I2C_IRQ_PRIO 5 | ||
#define I2C_IRQ_SUBPRIO 0 | ||
|
||
|
||
/* pin aliases */ | ||
/* may be PA_0 for some variants */ | ||
#define LED_BUILTIN PA_1 | ||
|
||
|
||
#endif /* __GREENPILL_HPP__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* @file main.cpp | ||
* @author Daniel Starke | ||
* @copyright Copyright 2022 Daniel Starke | ||
* @date 2022-05-29 | ||
* @version 2022-05-29 | ||
* | ||
* Simple blinky and EEPROM example with serial output. | ||
*/ | ||
#include <Arduino.h> | ||
#include <EEPROM.h> | ||
|
||
|
||
void setup() { | ||
Serial1.begin(115200); | ||
delay(100); | ||
pinMode(LED_BUILTIN, OUTPUT); | ||
Serial1.println("begin"); | ||
/* EEPROM */ | ||
Serial1.print("EEPROM size: "); | ||
Serial1.println(EEPROM.length()); | ||
/* boot count */ | ||
uint32_t bootCount; | ||
EEPROM.get(0, bootCount); | ||
Serial1.print("boot count: "); | ||
Serial1.println(bootCount); | ||
bootCount++; | ||
EEPROM.put(0, bootCount); | ||
} | ||
|
||
|
||
void loop() { | ||
static bool value = false; | ||
Serial1.println(value ? "LOW" : "HIGH"); | ||
digitalWrite(LED_BUILTIN, uint32_t(value)); | ||
value = !value; | ||
delay(500); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.