From 6fc91d581205d68f4cd1df2577ae4f016f1f57a1 Mon Sep 17 00:00:00 2001 From: Mathias Claussen | Elektor Labs Date: Mon, 4 May 2020 10:46:37 +0200 Subject: [PATCH 1/3] Added STM32F072CB varant for the Elektor LoRa Node As the STM32F072C8 ( 64kB ) is not proviiding much space for user applications after the LoRaWAN Stack is inside, the first production run will include a STM32F072CB ( 128kB) with the same pinout but a bit more falsh. The Variant has been renamed to reflect this change, also a new Board has added to the menu so you can choose what you have populated. --- boards.txt | 18 ++++++++-- variants/ELEKTOR_F072C8/PinNamesVar.h | 31 ----------------- .../PeripheralPins.c | 0 variants/ELEKTOR_F072Cx/PinNamesVar.h | 31 +++++++++++++++++ .../ldscript.ld | 6 ++-- .../variant.cpp | 0 .../variant.h | 34 +++++++++---------- 7 files changed, 66 insertions(+), 54 deletions(-) delete mode 100644 variants/ELEKTOR_F072C8/PinNamesVar.h rename variants/{ELEKTOR_F072C8 => ELEKTOR_F072Cx}/PeripheralPins.c (100%) create mode 100644 variants/ELEKTOR_F072Cx/PinNamesVar.h rename variants/{ELEKTOR_F072C8 => ELEKTOR_F072Cx}/ldscript.ld (96%) rename variants/{ELEKTOR_F072C8 => ELEKTOR_F072Cx}/variant.cpp (100%) rename variants/{ELEKTOR_F072C8 => ELEKTOR_F072Cx}/variant.h (81%) diff --git a/boards.txt b/boards.txt index e763020f39..3640075626 100644 --- a/boards.txt +++ b/boards.txt @@ -1736,17 +1736,29 @@ LoRa.menu.pnum.RHF76_052.build.cmsis_lib_gcc=arm_cortexM0l_math LoRa.menu.pnum.RHF76_052.build.extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} -D__CORTEX_SC=0 # ELEKTOR_F072C8 -LoRa.menu.pnum.ELEKTOR_F072C8=Elektor LoRa Node Core F072 +LoRa.menu.pnum.ELEKTOR_F072C8=Elektor LoRa Node Core F072C8 (64kB) LoRa.menu.pnum.ELEKTOR_F072C8.upload.maximum_data_size=16384 -LoRa.menu.pnum.ELEKTOR_F072C8.upload.maximum_size=131072 +LoRa.menu.pnum.ELEKTOR_F072C8.upload.maximum_size=65536 LoRa.menu.pnum.ELEKTOR_F072C8.build.mcu=cortex-m0 LoRa.menu.pnum.ELEKTOR_F072C8.build.board=ELEKTOR_F072C8 LoRa.menu.pnum.ELEKTOR_F072C8.build.series=STM32F0xx LoRa.menu.pnum.ELEKTOR_F072C8.build.product_line=STM32F072xB -LoRa.menu.pnum.ELEKTOR_F072C8.build.variant=ELEKTOR_F072C8 +LoRa.menu.pnum.ELEKTOR_F072C8.build.variant=ELEKTOR_F072Cx LoRa.menu.pnum.ELEKTOR_F072C8.build.cmsis_lib_gcc=arm_cortexM0l_math LoRa.menu.pnum.ELEKTOR_F072C8.build.extra_flags=-D{build.product_line} {build.xSerial} +# ELEKTOR_F072CB +LoRa.menu.pnum.ELEKTOR_F072CB=Elektor LoRa Node Core F072CB (128kB) +LoRa.menu.pnum.ELEKTOR_F072CB.upload.maximum_data_size=16384 +LoRa.menu.pnum.ELEKTOR_F072CB.upload.maximum_size=131072 +LoRa.menu.pnum.ELEKTOR_F072CB.build.mcu=cortex-m0 +LoRa.menu.pnum.ELEKTOR_F072CB.build.board=ELEKTOR_F072CB +LoRa.menu.pnum.ELEKTOR_F072CB.build.series=STM32F0xx +LoRa.menu.pnum.ELEKTOR_F072CB.build.product_line=STM32F072xB +LoRa.menu.pnum.ELEKTOR_F072CB.build.variant=ELEKTOR_F072Cx +LoRa.menu.pnum.ELEKTOR_F072CB.build.cmsis_lib_gcc=arm_cortexM0l_math +LoRa.menu.pnum.ELEKTOR_F072CB.build.extra_flags=-D{build.product_line} {build.xSerial} + # Upload menu LoRa.menu.upload_method.swdMethod=STM32CubeProgrammer (SWD) LoRa.menu.upload_method.swdMethod.upload.protocol=0 diff --git a/variants/ELEKTOR_F072C8/PinNamesVar.h b/variants/ELEKTOR_F072C8/PinNamesVar.h deleted file mode 100644 index 9906c8e95b..0000000000 --- a/variants/ELEKTOR_F072C8/PinNamesVar.h +++ /dev/null @@ -1,31 +0,0 @@ -/* SYS_WKUP */ -#ifdef PWR_WAKEUP_PIN1 - SYS_WKUP1 = PA_0, -#endif -#ifdef PWR_WAKEUP_PIN2 - SYS_WKUP2 = PC_13, -#endif -#ifdef PWR_WAKEUP_PIN3 - SYS_WKUP3 = PE_6, /* Not available in LQFP48 */ -#endif -#ifdef PWR_WAKEUP_PIN4 - SYS_WKUP4 = PA_2, -#endif -#ifdef PWR_WAKEUP_PIN5 - SYS_WKUP5 = PC_5, /* Not available in LQFP48 */ -#endif -#ifdef PWR_WAKEUP_PIN6 - SYS_WKUP6 = PB_5, -#endif -#ifdef PWR_WAKEUP_PIN7 - SYS_WKUP7 = PB_15, -#endif -#ifdef PWR_WAKEUP_PIN8 - SYS_WKUP8 = PF_2, /* Not available in LQFP48 */ -#endif -/* USB */ -#ifdef USBCON - USB_DM = PA_11, - USB_DP = PA_12, - USB_NOE = PA_13, -#endif diff --git a/variants/ELEKTOR_F072C8/PeripheralPins.c b/variants/ELEKTOR_F072Cx/PeripheralPins.c similarity index 100% rename from variants/ELEKTOR_F072C8/PeripheralPins.c rename to variants/ELEKTOR_F072Cx/PeripheralPins.c diff --git a/variants/ELEKTOR_F072Cx/PinNamesVar.h b/variants/ELEKTOR_F072Cx/PinNamesVar.h new file mode 100644 index 0000000000..43f9bbd535 --- /dev/null +++ b/variants/ELEKTOR_F072Cx/PinNamesVar.h @@ -0,0 +1,31 @@ +/* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 +SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 +SYS_WKUP2 = PC_13, +#endif +#ifdef PWR_WAKEUP_PIN3 +SYS_WKUP3 = PE_6, /* Not available in LQFP48 */ +#endif +#ifdef PWR_WAKEUP_PIN4 +SYS_WKUP4 = PA_2, +#endif +#ifdef PWR_WAKEUP_PIN5 +SYS_WKUP5 = PC_5, /* Not available in LQFP48 */ +#endif +#ifdef PWR_WAKEUP_PIN6 +SYS_WKUP6 = PB_5, +#endif +#ifdef PWR_WAKEUP_PIN7 +SYS_WKUP7 = PB_15, +#endif +#ifdef PWR_WAKEUP_PIN8 +SYS_WKUP8 = PF_2, /* Not available in LQFP48 */ +#endif +/* USB */ +#ifdef USBCON +USB_DM = PA_11, +USB_DP = PA_12, +USB_NOE = PA_13, +#endif diff --git a/variants/ELEKTOR_F072C8/ldscript.ld b/variants/ELEKTOR_F072Cx/ldscript.ld similarity index 96% rename from variants/ELEKTOR_F072C8/ldscript.ld rename to variants/ELEKTOR_F072Cx/ldscript.ld index 1669cca5e2..0831439511 100644 --- a/variants/ELEKTOR_F072C8/ldscript.ld +++ b/variants/ELEKTOR_F072Cx/ldscript.ld @@ -53,7 +53,7 @@ ENTRY(Reset_Handler) /* Highest address of the user mode stack */ -_estack = 0x20004000; /* end of "RAM" Ram type memory */ +_estack = 0x20000000 + LD_MAX_DATA_SIZE; /* end of "RAM" Ram type memory */ _Min_Heap_Size = 0x200 ; /* required amount of heap */ _Min_Stack_Size = 0x400 ; /* required amount of stack */ @@ -61,8 +61,8 @@ _Min_Stack_Size = 0x400 ; /* required amount of stack */ /* Memories definition */ MEMORY { - RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 16K - FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 64K + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = LD_MAX_DATA_SIZE + FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET } /* Sections */ diff --git a/variants/ELEKTOR_F072C8/variant.cpp b/variants/ELEKTOR_F072Cx/variant.cpp similarity index 100% rename from variants/ELEKTOR_F072C8/variant.cpp rename to variants/ELEKTOR_F072Cx/variant.cpp diff --git a/variants/ELEKTOR_F072C8/variant.h b/variants/ELEKTOR_F072Cx/variant.h similarity index 81% rename from variants/ELEKTOR_F072C8/variant.h rename to variants/ELEKTOR_F072Cx/variant.h index a153e81a69..ba829b65bd 100644 --- a/variants/ELEKTOR_F072C8/variant.h +++ b/variants/ELEKTOR_F072Cx/variant.h @@ -126,23 +126,23 @@ extern "C" { *----------------------------------------------------------------------------*/ #ifdef __cplusplus - // These serial port names are intended to allow libraries and architecture-neutral - // sketches to automatically default to the correct port name for a particular type - // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, - // the first hardware serial port whose RX/TX pins are not dedicated to another use. - // - // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor - // - // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial - // - // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library - // - // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. - // - // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX - // pins are NOT connected to anything by default. - #define SERIAL_PORT_MONITOR Serial - #define SERIAL_PORT_HARDWARE Serial +// These serial port names are intended to allow libraries and architecture-neutral +// sketches to automatically default to the correct port name for a particular type +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, +// the first hardware serial port whose RX/TX pins are not dedicated to another use. +// +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor +// +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial +// +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library +// +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. +// +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX +// pins are NOT connected to anything by default. +#define SERIAL_PORT_MONITOR Serial +#define SERIAL_PORT_HARDWARE Serial #endif #endif /* _VARIANT_ARDUINO_STM32_ */ From 98e90341aaa3143ab961e91db7b366ad4084f904 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Mon, 4 May 2020 11:34:12 +0200 Subject: [PATCH 2/3] Fix Astyle --- variants/ELEKTOR_F072Cx/PinNamesVar.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/variants/ELEKTOR_F072Cx/PinNamesVar.h b/variants/ELEKTOR_F072Cx/PinNamesVar.h index 43f9bbd535..9906c8e95b 100644 --- a/variants/ELEKTOR_F072Cx/PinNamesVar.h +++ b/variants/ELEKTOR_F072Cx/PinNamesVar.h @@ -1,31 +1,31 @@ /* SYS_WKUP */ #ifdef PWR_WAKEUP_PIN1 -SYS_WKUP1 = PA_0, + SYS_WKUP1 = PA_0, #endif #ifdef PWR_WAKEUP_PIN2 -SYS_WKUP2 = PC_13, + SYS_WKUP2 = PC_13, #endif #ifdef PWR_WAKEUP_PIN3 -SYS_WKUP3 = PE_6, /* Not available in LQFP48 */ + SYS_WKUP3 = PE_6, /* Not available in LQFP48 */ #endif #ifdef PWR_WAKEUP_PIN4 -SYS_WKUP4 = PA_2, + SYS_WKUP4 = PA_2, #endif #ifdef PWR_WAKEUP_PIN5 -SYS_WKUP5 = PC_5, /* Not available in LQFP48 */ + SYS_WKUP5 = PC_5, /* Not available in LQFP48 */ #endif #ifdef PWR_WAKEUP_PIN6 -SYS_WKUP6 = PB_5, + SYS_WKUP6 = PB_5, #endif #ifdef PWR_WAKEUP_PIN7 -SYS_WKUP7 = PB_15, + SYS_WKUP7 = PB_15, #endif #ifdef PWR_WAKEUP_PIN8 -SYS_WKUP8 = PF_2, /* Not available in LQFP48 */ + SYS_WKUP8 = PF_2, /* Not available in LQFP48 */ #endif /* USB */ #ifdef USBCON -USB_DM = PA_11, -USB_DP = PA_12, -USB_NOE = PA_13, + USB_DM = PA_11, + USB_DP = PA_12, + USB_NOE = PA_13, #endif From c7f59d6d2861ca44b921c06fe7695bb0545153ed Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Mon, 4 May 2020 11:35:11 +0200 Subject: [PATCH 3/3] Fix Astyle --- variants/ELEKTOR_F072Cx/variant.h | 34 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/variants/ELEKTOR_F072Cx/variant.h b/variants/ELEKTOR_F072Cx/variant.h index ba829b65bd..a153e81a69 100644 --- a/variants/ELEKTOR_F072Cx/variant.h +++ b/variants/ELEKTOR_F072Cx/variant.h @@ -126,23 +126,23 @@ extern "C" { *----------------------------------------------------------------------------*/ #ifdef __cplusplus -// These serial port names are intended to allow libraries and architecture-neutral -// sketches to automatically default to the correct port name for a particular type -// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, -// the first hardware serial port whose RX/TX pins are not dedicated to another use. -// -// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor -// -// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial -// -// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library -// -// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. -// -// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX -// pins are NOT connected to anything by default. -#define SERIAL_PORT_MONITOR Serial -#define SERIAL_PORT_HARDWARE Serial + // These serial port names are intended to allow libraries and architecture-neutral + // sketches to automatically default to the correct port name for a particular type + // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, + // the first hardware serial port whose RX/TX pins are not dedicated to another use. + // + // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor + // + // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial + // + // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library + // + // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. + // + // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX + // pins are NOT connected to anything by default. + #define SERIAL_PORT_MONITOR Serial + #define SERIAL_PORT_HARDWARE Serial #endif #endif /* _VARIANT_ARDUINO_STM32_ */