Skip to content

Commit d98267d

Browse files
puneet shrivasfpistm
puneet shrivas
andcommitted
vatiant(wb): add generic WB15CCU
Signed-off-by: puneet shrivas <[email protected]> Co-Authored-By: Frederic Pillon <[email protected]>
1 parent 294ace5 commit d98267d

File tree

4 files changed

+247
-2
lines changed

4 files changed

+247
-2
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
661661

662662
| Status | Device(s) | Name | Release | Notes |
663663
| :----: | :-------: | ---- | :-----: | :---- |
664+
| :yellow_heart: | STM32WB15CCU | Generic Board | **2.5.0** | |
664665
| :green_heart: | STM32WB55CC<br>STM32WB55CE<br>STM32WB55CG | Generic Board | *2.0.0* | |
665666
| :green_heart: | STM32WB5MMG | Generic Board | *2.1.0* | |
666667
| :green_heart: | STM32WB55RC<br>STM32WB55RE<br>STM32WB55RG | Generic Board | *2.0.0* | |

Diff for: boards.txt

+8
Original file line numberDiff line numberDiff line change
@@ -9532,6 +9532,14 @@ GenWB.build.cmsis_lib_gcc=arm_cortexM4lf_math
95329532
GenWB.upload.maximum_size=0
95339533
GenWB.upload.maximum_data_size=0
95349534

9535+
# Generic WB15CCUx
9536+
GenWB.menu.pnum.GENERIC_WB15CCUX=Generic WB15CCUx
9537+
GenWB.menu.pnum.GENERIC_WB15CCUX.upload.maximum_size=131072
9538+
GenWB.menu.pnum.GENERIC_WB15CCUX.upload.maximum_data_size=12288
9539+
GenWB.menu.pnum.GENERIC_WB15CCUX.build.board=GENERIC_WB15CCUX
9540+
GenWB.menu.pnum.GENERIC_WB15CCUX.build.product_line=STM32WB15xx
9541+
GenWB.menu.pnum.GENERIC_WB15CCUX.build.variant=STM32WBxx/WB15CCU
9542+
95359543
# Generic WB55CCUx
95369544
GenWB.menu.pnum.GENERIC_WB55CCUX=Generic WB55CCUx
95379545
GenWB.menu.pnum.GENERIC_WB55CCUX.upload.maximum_size=131072

Diff for: variants/STM32WBxx/WB15CCU/generic_clock.c

+55-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*/
1313
#if defined(ARDUINO_GENERIC_WB15CCUX)
1414
#include "pins_arduino.h"
15+
#include "lock_resource.h"
1516

1617
/**
1718
* @brief System Clock Configuration
@@ -20,8 +21,60 @@
2021
*/
2122
WEAK void SystemClock_Config(void)
2223
{
23-
/* SystemClock_Config can be generated by STM32CubeMX */
24-
#warning "SystemClock_Config() is empty. Default clock at reset is used."
24+
RCC_OscInitTypeDef RCC_OscInitStruct = {};
25+
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
26+
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {};
27+
28+
/* This prevents concurrent access to RCC registers by CPU2 (M0+) */
29+
hsem_lock(CFG_HW_RCC_SEMID, HSEM_LOCK_DEFAULT_RETRY);
30+
31+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_LSI1
32+
| RCC_OSCILLATORTYPE_MSI;
33+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
34+
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
35+
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
36+
RCC_OscInitStruct.MSICalibrationValue = RCC_MSICALIBRATION_DEFAULT;
37+
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_10;
38+
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
39+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
40+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
41+
Error_Handler();
42+
}
43+
44+
/** Configure the SYSCLKSource, HCLK, PCLK1 and PCLK2 clocks dividers
45+
*/
46+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK4 | RCC_CLOCKTYPE_HCLK2
47+
| RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
48+
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
49+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI;
50+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
51+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
52+
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
53+
RCC_ClkInitStruct.AHBCLK2Divider = RCC_SYSCLK_DIV1;
54+
RCC_ClkInitStruct.AHBCLK4Divider = RCC_SYSCLK_DIV1;
55+
56+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
57+
Error_Handler();
58+
}
59+
60+
/** Initializes the peripherals clock
61+
*/
62+
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SMPS;
63+
PeriphClkInitStruct.SmpsClockSelection = RCC_SMPSCLKSOURCE_HSI;
64+
PeriphClkInitStruct.SmpsDivSelection = RCC_SMPSCLKDIV_RANGE1;
65+
66+
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
67+
Error_Handler();
68+
}
69+
70+
LL_PWR_SMPS_SetStartupCurrent(LL_PWR_SMPS_STARTUP_CURRENT_80MA);
71+
LL_PWR_SMPS_SetOutputVoltageLevel(LL_PWR_SMPS_OUTPUT_VOLTAGE_1V40);
72+
LL_PWR_SMPS_Enable();
73+
74+
/* Select HSI as system clock source after Wake Up from Stop mode */
75+
LL_RCC_SetClkAfterWakeFromStop(LL_RCC_STOP_WAKEUPCLOCK_HSI);
76+
77+
hsem_unlock(CFG_HW_RCC_SEMID);
2578
}
2679

2780
#endif /* ARDUINO_GENERIC_* */

Diff for: variants/STM32WBxx/WB15CCU/ldscript.ld

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

0 commit comments

Comments
 (0)