Skip to content

Commit 8ab4da9

Browse files
chore(variant): add generic L431C(B-C)(T-U) (stm32duino#2427)
Signed-off-by: Jordan Cormack <[email protected]> Co-authored-by: Frederic Pillon <[email protected]>
1 parent b24801b commit 8ab4da9

File tree

4 files changed

+264
-2
lines changed

4 files changed

+264
-2
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
679679
| Status | Device(s) | Name | Release | Notes |
680680
| :----: | :-------: | ---- | :-----: | :---- |
681681
| :green_heart: | STM32L412K8<br>STM32L412KB<br>STM32L422KB | Generic Board | *2.0.0* | |
682+
| :yellow_heart: | STM32L431CB<br>STM32L431CC | Generic Board | **2.8.1** | |
682683
| :green_heart: | STM32L431RB<br>STM32L431RC | Generic Board | *2.3.0* | |
683684
| :green_heart: | STM32L432KB<br>STM32L432KC<br>STM32L442KC | Generic Board | *2.0.0* | |
684685
| :green_heart: | STM32L433CBT<br>STM32L433CCT | Generic Board | *2.1.0* | |

Diff for: boards.txt

+36
Original file line numberDiff line numberDiff line change
@@ -10831,6 +10831,42 @@ GenL4.menu.pnum.GENERIC_L422KBUX.build.product_line=STM32L422xx
1083110831
GenL4.menu.pnum.GENERIC_L422KBUX.build.variant=STM32L4xx/L412K(8-B)(T-U)_L422KB(T-U)
1083210832
GenL4.menu.pnum.GENERIC_L422KBUX.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32L4xx/STM32L4x2.svd
1083310833

10834+
# Generic L431CBTx
10835+
GenL4.menu.pnum.GENERIC_L431CBTX=Generic L431CBTx
10836+
GenL4.menu.pnum.GENERIC_L431CBTX.upload.maximum_size=131072
10837+
GenL4.menu.pnum.GENERIC_L431CBTX.upload.maximum_data_size=65536
10838+
GenL4.menu.pnum.GENERIC_L431CBTX.build.board=GENERIC_L431CBTX
10839+
GenL4.menu.pnum.GENERIC_L431CBTX.build.product_line=STM32L431xx
10840+
GenL4.menu.pnum.GENERIC_L431CBTX.build.variant=STM32L4xx/L431C(B-C)(T-U)
10841+
GenL4.menu.pnum.GENERIC_L431CBTX.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32L4xx/STM32L4x1.svd
10842+
10843+
# Generic L431CBUx
10844+
GenL4.menu.pnum.GENERIC_L431CBUX=Generic L431CBUx
10845+
GenL4.menu.pnum.GENERIC_L431CBUX.upload.maximum_size=131072
10846+
GenL4.menu.pnum.GENERIC_L431CBUX.upload.maximum_data_size=65536
10847+
GenL4.menu.pnum.GENERIC_L431CBUX.build.board=GENERIC_L431CBUX
10848+
GenL4.menu.pnum.GENERIC_L431CBUX.build.product_line=STM32L431xx
10849+
GenL4.menu.pnum.GENERIC_L431CBUX.build.variant=STM32L4xx/L431C(B-C)(T-U)
10850+
GenL4.menu.pnum.GENERIC_L431CBUX.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32L4xx/STM32L4x1.svd
10851+
10852+
# Generic L431CCTx
10853+
GenL4.menu.pnum.GENERIC_L431CCTX=Generic L431CCTx
10854+
GenL4.menu.pnum.GENERIC_L431CCTX.upload.maximum_size=262144
10855+
GenL4.menu.pnum.GENERIC_L431CCTX.upload.maximum_data_size=65536
10856+
GenL4.menu.pnum.GENERIC_L431CCTX.build.board=GENERIC_L431CCTX
10857+
GenL4.menu.pnum.GENERIC_L431CCTX.build.product_line=STM32L431xx
10858+
GenL4.menu.pnum.GENERIC_L431CCTX.build.variant=STM32L4xx/L431C(B-C)(T-U)
10859+
GenL4.menu.pnum.GENERIC_L431CCTX.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32L4xx/STM32L4x1.svd
10860+
10861+
# Generic L431CCUx
10862+
GenL4.menu.pnum.GENERIC_L431CCUX=Generic L431CCUx
10863+
GenL4.menu.pnum.GENERIC_L431CCUX.upload.maximum_size=262144
10864+
GenL4.menu.pnum.GENERIC_L431CCUX.upload.maximum_data_size=65536
10865+
GenL4.menu.pnum.GENERIC_L431CCUX.build.board=GENERIC_L431CCUX
10866+
GenL4.menu.pnum.GENERIC_L431CCUX.build.product_line=STM32L431xx
10867+
GenL4.menu.pnum.GENERIC_L431CCUX.build.variant=STM32L4xx/L431C(B-C)(T-U)
10868+
GenL4.menu.pnum.GENERIC_L431CCUX.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32L4xx/STM32L4x1.svd
10869+
1083410870
# Generic L431RBIx
1083510871
GenL4.menu.pnum.GENERIC_L431RBIX=Generic L431RBIx
1083610872
GenL4.menu.pnum.GENERIC_L431RBIX.upload.maximum_size=131072

Diff for: variants/STM32L4xx/L431C(B-C)(T-U)/generic_clock.c

+38-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,44 @@
2121
*/
2222
WEAK void SystemClock_Config(void)
2323
{
24-
/* SystemClock_Config can be generated by STM32CubeMX */
25-
#warning "SystemClock_Config() is empty. Default clock at reset is used."
24+
RCC_OscInitTypeDef RCC_OscInitStruct = {};
25+
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
26+
27+
/** Configure the main internal regulator output voltage
28+
*/
29+
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK) {
30+
Error_Handler();
31+
}
32+
33+
/** Initializes the RCC Oscillators according to the specified parameters
34+
* in the RCC_OscInitTypeDef structure.
35+
*/
36+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
37+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
38+
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
39+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
40+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
41+
RCC_OscInitStruct.PLL.PLLM = 1;
42+
RCC_OscInitStruct.PLL.PLLN = 10;
43+
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV7;
44+
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
45+
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
46+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
47+
Error_Handler();
48+
}
49+
50+
/** Initializes the CPU, AHB and APB buses clocks
51+
*/
52+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
53+
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
54+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
55+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
56+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
57+
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
58+
59+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK) {
60+
Error_Handler();
61+
}
2662
}
2763

2864
#endif /* ARDUINO_GENERIC_* */

Diff for: variants/STM32L4xx/L431C(B-C)(T-U)/ldscript.ld

+189
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
/*
2+
******************************************************************************
3+
**
4+
** @file : LinkerScript.ld
5+
**
6+
** @author : Auto-generated by STM32CubeIDE
7+
**
8+
** @brief : Linker script for STM32L431CCUx Device from STM32L4 series
9+
** 256KBytes FLASH
10+
** 64KBytes RAM
11+
** 16KBytes RAM2
12+
**
13+
** Set heap size, stack size and stack location according
14+
** to application requirements.
15+
**
16+
** Set memory bank area and size if external memory is used
17+
**
18+
** Target : STMicroelectronics STM32
19+
**
20+
** Distribution: The file is distributed as is, without any warranty
21+
** of any kind.
22+
**
23+
******************************************************************************
24+
** @attention
25+
**
26+
** Copyright (c) 2024 STMicroelectronics.
27+
** All rights reserved.
28+
**
29+
** This software is licensed under terms that can be found in the LICENSE file
30+
** in the root directory of this software component.
31+
** If no LICENSE file comes with this software, it is provided AS-IS.
32+
**
33+
******************************************************************************
34+
*/
35+
36+
/* Entry Point */
37+
ENTRY(Reset_Handler)
38+
39+
/* Highest address of the user mode stack */
40+
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
41+
42+
_Min_Heap_Size = 0x200; /* required amount of heap */
43+
_Min_Stack_Size = 0x400; /* required amount of stack */
44+
45+
/* Memories definition */
46+
MEMORY
47+
{
48+
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = LD_MAX_DATA_SIZE
49+
RAM2 (xrw) : ORIGIN = 0x10000000, LENGTH = 16K
50+
FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET
51+
}
52+
53+
/* Sections */
54+
SECTIONS
55+
{
56+
/* The startup code into "FLASH" Rom type memory */
57+
.isr_vector :
58+
{
59+
. = ALIGN(4);
60+
KEEP(*(.isr_vector)) /* Startup code */
61+
. = ALIGN(4);
62+
} >FLASH
63+
64+
/* The program code and other data into "FLASH" Rom type memory */
65+
.text :
66+
{
67+
. = ALIGN(4);
68+
*(.text) /* .text sections (code) */
69+
*(.text*) /* .text* sections (code) */
70+
*(.glue_7) /* glue arm to thumb code */
71+
*(.glue_7t) /* glue thumb to arm code */
72+
*(.eh_frame)
73+
74+
KEEP (*(.init))
75+
KEEP (*(.fini))
76+
77+
. = ALIGN(4);
78+
_etext = .; /* define a global symbols at end of code */
79+
} >FLASH
80+
81+
/* Constant data into "FLASH" Rom type memory */
82+
.rodata :
83+
{
84+
. = ALIGN(4);
85+
*(.rodata) /* .rodata sections (constants, strings, etc.) */
86+
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
87+
. = ALIGN(4);
88+
} >FLASH
89+
90+
.ARM.extab (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
91+
{
92+
. = ALIGN(4);
93+
*(.ARM.extab* .gnu.linkonce.armextab.*)
94+
. = ALIGN(4);
95+
} >FLASH
96+
97+
.ARM (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
98+
{
99+
. = ALIGN(4);
100+
__exidx_start = .;
101+
*(.ARM.exidx*)
102+
__exidx_end = .;
103+
. = ALIGN(4);
104+
} >FLASH
105+
106+
.preinit_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
107+
{
108+
. = ALIGN(4);
109+
PROVIDE_HIDDEN (__preinit_array_start = .);
110+
KEEP (*(.preinit_array*))
111+
PROVIDE_HIDDEN (__preinit_array_end = .);
112+
. = ALIGN(4);
113+
} >FLASH
114+
115+
.init_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
116+
{
117+
. = ALIGN(4);
118+
PROVIDE_HIDDEN (__init_array_start = .);
119+
KEEP (*(SORT(.init_array.*)))
120+
KEEP (*(.init_array*))
121+
PROVIDE_HIDDEN (__init_array_end = .);
122+
. = ALIGN(4);
123+
} >FLASH
124+
125+
.fini_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
126+
{
127+
. = ALIGN(4);
128+
PROVIDE_HIDDEN (__fini_array_start = .);
129+
KEEP (*(SORT(.fini_array.*)))
130+
KEEP (*(.fini_array*))
131+
PROVIDE_HIDDEN (__fini_array_end = .);
132+
. = ALIGN(4);
133+
} >FLASH
134+
135+
/* Used by the startup to initialize data */
136+
_sidata = LOADADDR(.data);
137+
138+
/* Initialized data sections into "RAM" Ram type memory */
139+
.data :
140+
{
141+
. = ALIGN(4);
142+
_sdata = .; /* create a global symbol at data start */
143+
*(.data) /* .data sections */
144+
*(.data*) /* .data* sections */
145+
*(.RamFunc) /* .RamFunc sections */
146+
*(.RamFunc*) /* .RamFunc* sections */
147+
148+
. = ALIGN(4);
149+
_edata = .; /* define a global symbol at data end */
150+
151+
} >RAM AT> FLASH
152+
153+
/* Uninitialized data section into "RAM" Ram type memory */
154+
. = ALIGN(4);
155+
.bss :
156+
{
157+
/* This is used by the startup in order to initialize the .bss section */
158+
_sbss = .; /* define a global symbol at bss start */
159+
__bss_start__ = _sbss;
160+
*(.bss)
161+
*(.bss*)
162+
*(COMMON)
163+
164+
. = ALIGN(4);
165+
_ebss = .; /* define a global symbol at bss end */
166+
__bss_end__ = _ebss;
167+
} >RAM
168+
169+
/* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
170+
._user_heap_stack :
171+
{
172+
. = ALIGN(8);
173+
PROVIDE ( end = . );
174+
PROVIDE ( _end = . );
175+
. = . + _Min_Heap_Size;
176+
. = . + _Min_Stack_Size;
177+
. = ALIGN(8);
178+
} >RAM
179+
180+
/* Remove information from the compiler libraries */
181+
/DISCARD/ :
182+
{
183+
libc.a ( * )
184+
libm.a ( * )
185+
libgcc.a ( * )
186+
}
187+
188+
.ARM.attributes 0 : { *(.ARM.attributes) }
189+
}

0 commit comments

Comments
 (0)