Skip to content

Commit f89c47f

Browse files
committed
added generic L431C(B-C)(T-U) variant
1 parent edd1785 commit f89c47f

File tree

4 files changed

+267
-2
lines changed

4 files changed

+267
-2
lines changed

README.md

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

boards.txt

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

10798+
# Generic L431CBTx
10799+
GenL4.menu.pnum.GENERIC_L431CBTX=Generic L431CBTx
10800+
GenL4.menu.pnum.GENERIC_L431CBTX.upload.maximum_size=131072
10801+
GenL4.menu.pnum.GENERIC_L431CBTX.upload.maximum_data_size=65536
10802+
GenL4.menu.pnum.GENERIC_L431CBTX.build.board=GENERIC_L431CBTX
10803+
GenL4.menu.pnum.GENERIC_L431CBTX.build.product_line=STM32L431xx
10804+
GenL4.menu.pnum.GENERIC_L431CBTX.build.variant=STM32L4xx/L431C(B-C)(T-U)
10805+
GenL4.menu.pnum.GENERIC_L431CBTX.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32L4xx/STM32L4x1.svd
10806+
10807+
# Generic L431CCTx
10808+
GenL4.menu.pnum.GENERIC_L431CCTX=Generic L431CCTx
10809+
GenL4.menu.pnum.GENERIC_L431CCTX.upload.maximum_size=262144
10810+
GenL4.menu.pnum.GENERIC_L431CCTX.upload.maximum_data_size=65536
10811+
GenL4.menu.pnum.GENERIC_L431CCTX.build.board=GENERIC_L431CCTX
10812+
GenL4.menu.pnum.GENERIC_L431CCTX.build.product_line=STM32L431xx
10813+
GenL4.menu.pnum.GENERIC_L431CCTX.build.variant=STM32L4xx/L431C(B-C)(T-U)
10814+
GenL4.menu.pnum.GENERIC_L431CCTX.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32L4xx/STM32L4x1.svd
10815+
10816+
# Generic L431CBUx
10817+
GenL4.menu.pnum.GENERIC_L431CBUX=Generic L431CBUx
10818+
GenL4.menu.pnum.GENERIC_L431CBUX.upload.maximum_size=131072
10819+
GenL4.menu.pnum.GENERIC_L431CBUX.upload.maximum_data_size=65536
10820+
GenL4.menu.pnum.GENERIC_L431CBUX.build.board=GENERIC_L431CBUX
10821+
GenL4.menu.pnum.GENERIC_L431CBUX.build.product_line=STM32L431xx
10822+
GenL4.menu.pnum.GENERIC_L431CBUX.build.variant=STM32L4xx/L431C(B-C)(T-U)
10823+
GenL4.menu.pnum.GENERIC_L431CBUX.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32L4xx/STM32L4x1.svd
10824+
10825+
# Generic L431CCUx
10826+
GenL4.menu.pnum.GENERIC_L431CCUX=Generic L431CCUx
10827+
GenL4.menu.pnum.GENERIC_L431CCUX.upload.maximum_size=262144
10828+
GenL4.menu.pnum.GENERIC_L431CCUX.upload.maximum_data_size=65536
10829+
GenL4.menu.pnum.GENERIC_L431CCUX.build.board=GENERIC_L431CCUX
10830+
GenL4.menu.pnum.GENERIC_L431CCUX.build.product_line=STM32L431xx
10831+
GenL4.menu.pnum.GENERIC_L431CCUX.build.variant=STM32L4xx/L431C(B-C)(T-U)
10832+
GenL4.menu.pnum.GENERIC_L431CCUX.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32L4xx/STM32L4x1.svd
10833+
1079810834
# Generic L431RBIx
1079910835
GenL4.menu.pnum.GENERIC_L431RBIX=Generic L431RBIx
1080010836
GenL4.menu.pnum.GENERIC_L431RBIX.upload.maximum_size=131072

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

+41-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,47 @@
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+
{
31+
Error_Handler();
32+
}
33+
34+
/** Initializes the RCC Oscillators according to the specified parameters
35+
* in the RCC_OscInitTypeDef structure.
36+
*/
37+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
38+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
39+
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
40+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
41+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
42+
RCC_OscInitStruct.PLL.PLLM = 1;
43+
RCC_OscInitStruct.PLL.PLLN = 10;
44+
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV7;
45+
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
46+
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
47+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
48+
{
49+
Error_Handler();
50+
}
51+
52+
/** Initializes the CPU, AHB and APB buses clocks
53+
*/
54+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
55+
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
56+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
57+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
58+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
59+
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
60+
61+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK)
62+
{
63+
Error_Handler();
64+
}
2665
}
2766

2867
#endif /* ARDUINO_GENERIC_* */
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)