Skip to content

Commit 8d882bc

Browse files
dgarskedanielinux
authored andcommitted
Peer review cleanups and added CI test.
1 parent a6fc952 commit 8d882bc

File tree

3 files changed

+15
-24
lines changed

3 files changed

+15
-24
lines changed

.github/workflows/test-configs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ jobs:
138138

139139
# TODO: SP math with small stack has issues
140140

141+
stm32c0:
142+
uses: ./.github/workflows/test-build.yml
143+
with:
144+
arch: arm
145+
config-file: ./config/examples/stm32c0.config
146+
141147
stm32f4_small_blocks_uart_update_test:
142148
uses: ./.github/workflows/test-build.yml
143149
with:

hal/stm32c0.c

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@
3636

3737
/*** RCC ***/
3838
#define RCC_BASE (0x40021000)
39-
#define RCC_CR (*(volatile uint32_t *)(RCC_BASE + 0x00)) /* RM0444 - 5.4.1 */
40-
#define RCC_CFGR (*(volatile uint32_t *)(RCC_BASE + 0x08)) /* RM0444 - 5.4.3 */
41-
#define APB1_CLOCK_ER (*(volatile uint32_t *)(RCC_BASE + 0x3C))
42-
#define APB2_CLOCK_ER (*(volatile uint32_t *)(RCC_BASE + 0x40))
43-
39+
#define RCC_CR (*(volatile uint32_t *)(RCC_BASE + 0x00)) /* RM0490 - 5.4.1 */
40+
#define RCC_CFGR (*(volatile uint32_t *)(RCC_BASE + 0x08)) /* RM0490 - 5.4.3 */
41+
#define APB1_CLOCK_ER (*(volatile uint32_t *)(RCC_BASE + 0x3C)) /* RM0490 - 5.4.13 */
42+
#define APB2_CLOCK_ER (*(volatile uint32_t *)(RCC_BASE + 0x40)) /* RM0490 - 5.4.14 */
4443

4544
#define RCC_CR_HSIRDY (1 << 10)
4645
#define RCC_CR_HSION (1 << 8)
@@ -56,20 +55,14 @@
5655
#define RCC_CR_HSIDIV_64 (6ul << RCC_CR_HSIDIV_SHIFT)
5756
#define RCC_CR_HSIDIV_128 (7ul << RCC_CR_HSIDIV_SHIFT)
5857

59-
6058
#define RCC_CFGR_SW_HSISYS 0x0
61-
#define RCC_CFGR_SW_PLL 0x2
62-
#define RCC_PLLCFGR_PLLR_EN (1 << 28) /* RM0444 - 5.4.3 */
63-
64-
#define RCC_PLLCFGR_PLLSRC_HSI16 2
65-
6659

6760
/*** APB PRESCALER ***/
6861
#define RCC_PRESCALER_DIV_NONE 0
6962

7063
/*** FLASH ***/
7164
#define PWR_APB1_CLOCK_ER_VAL (1 << 28)
72-
#define SYSCFG_APB2_CLOCK_ER_VAL (1 << 0) /* RM0444 - 5.4.15 - RCC_APBENR2 - SYSCFGEN */
65+
#define SYSCFG_APB2_CLOCK_ER_VAL (1 << 0) /* RM0490 - 5.4.14 - RCC_APBENR2 - SYSCFGEN */
7366

7467
#define FLASH_BASE (0x40022000) /*FLASH_R_BASE = 0x40000000UL + 0x00020000UL + 0x00002000UL */
7568
#define FLASH_ACR (*(volatile uint32_t *)(FLASH_BASE + 0x00)) /* RM0490 - 3.7.1 - FLASH_ACR */
@@ -230,26 +223,18 @@ static void clock_pll_off(void)
230223
DMB();
231224
}
232225

233-
/* This implementation will setup HSI RC 48 MHz as System Clock Source, set
234-
* flash wait state to 1, and set all peripherals to 16MHz (div4)
235-
*/
226+
/* This implementation will setup HSI RC 48 MHz as System Clock Source and set
227+
* flash wait state to 1 */
236228
static void clock_pll_on(int powersave)
237229
{
238230
uint32_t reg32;
239-
uint32_t cpu_freq, plln, pllm, pllq, pllp, pllr, hpre, ppre, flash_waitstates;
231+
uint32_t cpu_freq, flash_waitstates;
240232

241233
/* Enable Power controller */
242234
APB1_CLOCK_ER |= PWR_APB1_CLOCK_ER_VAL;
243235

244236
/* Select clock parameters (CPU Speed = 48MHz) */
245237
cpu_freq = 48000000;
246-
pllm = 4;
247-
plln = 80;
248-
pllp = 10;
249-
pllq = 5;
250-
pllr = 5;
251-
hpre = RCC_PRESCALER_DIV_NONE;
252-
ppre = RCC_PRESCALER_DIV_NONE;
253238
flash_waitstates = 1;
254239

255240
flash_set_waitstates(flash_waitstates);

hal/stm32c0.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
MEMORY
22
{
33
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = @BOOTLOADER_PARTITION_SIZE@
4-
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 12K-1
4+
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 12K
55
}
66

77
SECTIONS

0 commit comments

Comments
 (0)