Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 84b0b97

Browse files
committedMay 22, 2025
add nucleo variant
1 parent 6ffb696 commit 84b0b97

File tree

5 files changed

+952
-0
lines changed

5 files changed

+952
-0
lines changed
 

‎variants/STM32C0xx/C092CBT_C092RBT_C092RC(I-T)/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ target_link_libraries(variant INTERFACE variant_usage)
2121
add_library(variant_bin STATIC EXCLUDE_FROM_ALL
2222
generic_clock.c
2323
PeripheralPins.c
24+
PeripheralPins_NUCLEO_C092RC.c
2425
variant_generic.cpp
26+
variant_NUCLEO_C092RC.cpp
2527
)
2628
target_link_libraries(variant_bin PUBLIC variant_usage)
2729

‎variants/STM32C0xx/C092CBT_C092RBT_C092RC(I-T)/PeripheralPins_NUCLEO_C092RC.c

Lines changed: 412 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
/*
2+
******************************************************************************
3+
**
4+
** @file : LinkerScript.ld
5+
**
6+
** @author : Auto-generated by STM32CubeIDE
7+
**
8+
** Abstract : Linker script for NUCLEO-C092RC Board embedding STM32C092RCTx Device from stm32c0 series
9+
** 256KBytes FLASH
10+
** 30KBytes 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) 2025 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(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
40+
41+
_Min_Heap_Size = 0x200; /* required amount of heap */
42+
_Min_Stack_Size = 0x400; /* required amount of stack */
43+
44+
/* Memories definition */
45+
MEMORY
46+
{
47+
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = LD_MAX_DATA_SIZE
48+
FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET
49+
}
50+
51+
/* Sections */
52+
SECTIONS
53+
{
54+
/* The startup code into "FLASH" Rom type memory */
55+
.isr_vector :
56+
{
57+
. = ALIGN(4);
58+
KEEP(*(.isr_vector)) /* Startup code */
59+
. = ALIGN(4);
60+
} >FLASH
61+
62+
/* The program code and other data into "FLASH" Rom type memory */
63+
.text :
64+
{
65+
. = ALIGN(4);
66+
*(.text) /* .text sections (code) */
67+
*(.text*) /* .text* sections (code) */
68+
*(.glue_7) /* glue arm to thumb code */
69+
*(.glue_7t) /* glue thumb to arm code */
70+
*(.eh_frame)
71+
72+
KEEP (*(.init))
73+
KEEP (*(.fini))
74+
75+
. = ALIGN(4);
76+
_etext = .; /* define a global symbols at end of code */
77+
} >FLASH
78+
79+
/* Constant data into "FLASH" Rom type memory */
80+
.rodata :
81+
{
82+
. = ALIGN(4);
83+
*(.rodata) /* .rodata sections (constants, strings, etc.) */
84+
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
85+
. = ALIGN(4);
86+
} >FLASH
87+
88+
.ARM.extab (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
89+
{
90+
. = ALIGN(4);
91+
*(.ARM.extab* .gnu.linkonce.armextab.*)
92+
. = ALIGN(4);
93+
} >FLASH
94+
95+
.ARM (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
96+
{
97+
. = ALIGN(4);
98+
__exidx_start = .;
99+
*(.ARM.exidx*)
100+
__exidx_end = .;
101+
. = ALIGN(4);
102+
} >FLASH
103+
104+
.preinit_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
105+
{
106+
. = ALIGN(4);
107+
PROVIDE_HIDDEN (__preinit_array_start = .);
108+
KEEP (*(.preinit_array*))
109+
PROVIDE_HIDDEN (__preinit_array_end = .);
110+
. = ALIGN(4);
111+
} >FLASH
112+
113+
.init_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
114+
{
115+
. = ALIGN(4);
116+
PROVIDE_HIDDEN (__init_array_start = .);
117+
KEEP (*(SORT(.init_array.*)))
118+
KEEP (*(.init_array*))
119+
PROVIDE_HIDDEN (__init_array_end = .);
120+
. = ALIGN(4);
121+
} >FLASH
122+
123+
.fini_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
124+
{
125+
. = ALIGN(4);
126+
PROVIDE_HIDDEN (__fini_array_start = .);
127+
KEEP (*(SORT(.fini_array.*)))
128+
KEEP (*(.fini_array*))
129+
PROVIDE_HIDDEN (__fini_array_end = .);
130+
. = ALIGN(4);
131+
} >FLASH
132+
133+
/* Used by the startup to initialize data */
134+
_sidata = LOADADDR(.data);
135+
136+
/* Initialized data sections into "RAM" Ram type memory */
137+
.data :
138+
{
139+
. = ALIGN(4);
140+
_sdata = .; /* create a global symbol at data start */
141+
*(.data) /* .data sections */
142+
*(.data*) /* .data* sections */
143+
*(.RamFunc) /* .RamFunc sections */
144+
*(.RamFunc*) /* .RamFunc* sections */
145+
146+
. = ALIGN(4);
147+
_edata = .; /* define a global symbol at data end */
148+
149+
} >RAM AT> FLASH
150+
151+
/* Uninitialized data section into "RAM" Ram type memory */
152+
. = ALIGN(4);
153+
.bss :
154+
{
155+
/* This is used by the startup in order to initialize the .bss section */
156+
_sbss = .; /* define a global symbol at bss start */
157+
__bss_start__ = _sbss;
158+
*(.bss)
159+
*(.bss*)
160+
*(COMMON)
161+
162+
. = ALIGN(4);
163+
_ebss = .; /* define a global symbol at bss end */
164+
__bss_end__ = _ebss;
165+
} >RAM
166+
167+
/* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
168+
._user_heap_stack :
169+
{
170+
. = ALIGN(8);
171+
PROVIDE ( end = . );
172+
PROVIDE ( _end = . );
173+
. = . + _Min_Heap_Size;
174+
. = . + _Min_Stack_Size;
175+
. = ALIGN(8);
176+
} >RAM
177+
178+
/* Remove information from the compiler libraries */
179+
/DISCARD/ :
180+
{
181+
libc.a ( * )
182+
libm.a ( * )
183+
libgcc.a ( * )
184+
}
185+
186+
.ARM.attributes 0 : { *(.ARM.attributes) }
187+
}
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2024, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* This software component is licensed by ST under BSD 3-Clause license,
7+
* the "License"; You may not use this file except in compliance with the
8+
* License. You may obtain a copy of the License at:
9+
* opensource.org/licenses/BSD-3-Clause
10+
*
11+
*******************************************************************************
12+
*/
13+
#if defined(ARDUINO_NUCLEO_C092RC)
14+
#include "pins_arduino.h"
15+
#include "stm32yyxx_ll_utils.h"
16+
17+
// Digital PinName array
18+
const PinName digitalPin[] = {
19+
PB_7, // D0
20+
PB_6, // D1
21+
PA_10, // D2
22+
PC_7, // D3
23+
PB_5, // D4
24+
PB_4, // D5
25+
PC_8, // D6
26+
PA_8, // D7/A6
27+
PA_9, // D8
28+
PB_3, // D9
29+
PA_15, // D10
30+
PA_7, // D11/A7
31+
PA_6, // D12/A8
32+
PA_5, // D13/A9
33+
PB_9, // D14
34+
PB_8, // D15
35+
PA_0, // D16/A0
36+
PA_1, // D17/A1
37+
PA_4, // D18/A2
38+
PB_0, // D19/A3
39+
PC_4, // D20/A4
40+
PC_5, // D21/A5
41+
PC_10, // D22
42+
PC_12, // D23
43+
PD_4, // D24
44+
PD_0, // D25
45+
PD_3, // D26
46+
PA_13, // D27
47+
PA_14, // D28
48+
PC_6, // D29
49+
PC_2, // D30
50+
PC_13, // D31
51+
PC_14, // D32
52+
PC_15, // D33
53+
PF_0, // D34
54+
PF_1, // D35
55+
PF_3, // D36
56+
PB_2, // D37/A10
57+
PB_11, // D38/A11
58+
PC_11, // D39
59+
PD_2, // D40
60+
PD_1, // D41
61+
PF_2, // D42
62+
PD_5, // D43
63+
PC_3, // D44
64+
PC_9, // D45
65+
PC_1, // D46
66+
PA_3, // D47
67+
PD_6, // D48
68+
PA_12, // D49
69+
PA_11, // D50
70+
PB_12, // D51/A12
71+
PA_2, // D52
72+
PC_0, // D53
73+
PB_1, // D54/A13
74+
PB_15, // D55
75+
PB_14, // D56
76+
PB_13, // D57
77+
PB_10, // D58/A14
78+
PD_8, // D59
79+
PD_9 // D60
80+
};
81+
82+
// Analog (Ax) pin number array
83+
const uint32_t analogInputPin[] = {
84+
16, // A0, PA0
85+
17, // A1, PA1
86+
18, // A2, PA4
87+
19, // A3, PB0
88+
20, // A4, PC4
89+
21, // A5, PC5
90+
7, // A6, PA8
91+
11, // A7, PA7
92+
12, // A8, PA6
93+
13, // A9, PA5
94+
37, // A10, PB2
95+
38, // A11, PB11
96+
51, // A12, PB12
97+
54, // A13, PB1
98+
58 // A14, PB10
99+
};
100+
101+
// ----------------------------------------------------------------------------
102+
#ifdef __cplusplus
103+
extern "C" {
104+
#endif
105+
106+
/**
107+
* @brief System Clock Configuration
108+
* @param None
109+
* @retval None
110+
*/
111+
void SystemClock_Config(void)
112+
{
113+
RCC_OscInitTypeDef RCC_OscInitStruct = {};
114+
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
115+
116+
__HAL_FLASH_SET_LATENCY(FLASH_LATENCY_1);
117+
118+
/** Initializes the RCC Oscillators according to the specified parameters
119+
* in the RCC_OscInitTypeDef structure.
120+
*/
121+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
122+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
123+
RCC_OscInitStruct.HSIDiv = RCC_HSI_DIV1;
124+
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
125+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
126+
{
127+
Error_Handler();
128+
}
129+
130+
/** Initializes the CPU, AHB and APB buses clocks
131+
*/
132+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
133+
|RCC_CLOCKTYPE_PCLK1;
134+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
135+
RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
136+
RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV1;
137+
RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV1;
138+
139+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
140+
{
141+
Error_Handler();
142+
}
143+
}
144+
145+
146+
#ifdef __cplusplus
147+
}
148+
#endif
149+
#endif /* ARDUINO_NUCLEO_C092RC */
Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2024, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* This software component is licensed by ST under BSD 3-Clause license,
7+
* the "License"; You may not use this file except in compliance with the
8+
* License. You may obtain a copy of the License at:
9+
* opensource.org/licenses/BSD-3-Clause
10+
*
11+
*******************************************************************************
12+
*/
13+
#pragma once
14+
15+
/*----------------------------------------------------------------------------
16+
* STM32 pins number
17+
*----------------------------------------------------------------------------*/
18+
#define PB7 0
19+
#define PB6 1
20+
#define PA10 2
21+
#define PC7 3
22+
#define PB5 4
23+
#define PB4 5
24+
#define PC8 6
25+
#define PA8 PIN_A6
26+
#define PA9 8
27+
#define PB3 9
28+
#define PA15 10
29+
#define PA7 PIN_A7
30+
#define PA6 PIN_A8
31+
#define PA5 PIN_A9 // LED1
32+
#define PB9 14
33+
#define PB8 15
34+
#define PA0 PIN_A0
35+
#define PA1 PIN_A1
36+
#define PA4 PIN_A2
37+
#define PB0 PIN_A3
38+
#define PC4 PIN_A4
39+
#define PC5 PIN_A5
40+
// ST Morpho
41+
// CN7 Left Side
42+
#define PC10 22
43+
#define PC12 23
44+
#define PD4 24
45+
#define PD0 25
46+
#define PD3 26
47+
#define PA13 27 // SWD
48+
#define PA14 28 // SWD
49+
#define PC6 29
50+
#define PC2 30 // FDCAN_RX
51+
#define PC13 31 // USER_BTN
52+
#define PC14 32 // OSCX_IN
53+
#define PC15 33 // OSCX_OUT
54+
#define PF0 34 // OSC_IN
55+
#define PF1 35 // OSC_OUT
56+
#define PF3 36 // VBAT
57+
#define PB2 PIN_A10
58+
#define PB11 PIN_A11
59+
// CN7 Right Side
60+
#define PC11 39
61+
#define PD2 40
62+
#define PD1 41
63+
#define PF2 42 // NRST
64+
#define PD5 43
65+
// CN10 Left Side
66+
#define PC3 44 // FDCAN_TX
67+
// CN10 Right side
68+
#define PC9 45 // LED2
69+
#define PC1 46
70+
#define PA3 47 // RX
71+
#define PD6 48
72+
#define PA12 49
73+
#define PA11 50
74+
#define PB12 PIN_A12
75+
#define PA2 52 // TX
76+
#define PC0 53
77+
#define PB1 PIN_A13
78+
#define PB15 55
79+
#define PB14 56
80+
#define PB13 57
81+
#define PB10 PIN_A14
82+
#define PD8 59
83+
#define PD9 60
84+
85+
// Alternate pins number
86+
#define PA0_ALT1 (PA0 | ALT1)
87+
#define PA0_ALT2 (PA0 | ALT2)
88+
#define PA1_ALT1 (PA1 | ALT1)
89+
#define PA1_ALT2 (PA1 | ALT2)
90+
#define PA2_ALT1 (PA2 | ALT1)
91+
#define PA2_ALT2 (PA2 | ALT2)
92+
#define PA3_ALT1 (PA3 | ALT1)
93+
#define PA3_ALT2 (PA3 | ALT2)
94+
#define PA4_ALT1 (PA4 | ALT1)
95+
#define PA4_ALT2 (PA4 | ALT2)
96+
#define PA5_ALT1 (PA5 | ALT1)
97+
#define PA5_ALT2 (PA5 | ALT2)
98+
#define PA6_ALT1 (PA6 | ALT1)
99+
#define PA7_ALT1 (PA7 | ALT1)
100+
#define PA7_ALT2 (PA7 | ALT2)
101+
#define PA7_ALT3 (PA7 | ALT3)
102+
#define PA8_ALT1 (PA8 | ALT1)
103+
#define PA8_ALT2 (PA8 | ALT2)
104+
#define PA8_ALT3 (PA8 | ALT3)
105+
#define PA8_ALT4 (PA8 | ALT4)
106+
#define PA8_ALT5 (PA8 | ALT5)
107+
#define PA9_ALT1 (PA9 | ALT1)
108+
#define PA10_ALT1 (PA10 | ALT1)
109+
#define PA15_ALT1 (PA15 | ALT1)
110+
#define PB0_ALT1 (PB0 | ALT1)
111+
#define PB1_ALT1 (PB1 | ALT1)
112+
#define PB1_ALT2 (PB1 | ALT2)
113+
#define PB1_ALT3 (PB1 | ALT3)
114+
#define PB3_ALT1 (PB3 | ALT1)
115+
#define PB3_ALT2 (PB3 | ALT2)
116+
#define PB5_ALT1 (PB5 | ALT1)
117+
#define PB6_ALT1 (PB6 | ALT1)
118+
#define PB6_ALT2 (PB6 | ALT2)
119+
#define PB6_ALT3 (PB6 | ALT3)
120+
#define PB6_ALT4 (PB6 | ALT4)
121+
#define PB6_ALT5 (PB6 | ALT5)
122+
#define PB7_ALT1 (PB7 | ALT1)
123+
#define PB7_ALT2 (PB7 | ALT2)
124+
#define PB7_ALT3 (PB7 | ALT3)
125+
#define PB7_ALT4 (PB7 | ALT4)
126+
#define PB8_ALT1 (PB8 | ALT1)
127+
#define PB9_ALT1 (PB9 | ALT1)
128+
#define PC6_ALT1 (PC6 | ALT1)
129+
#define PC7_ALT1 (PC7 | ALT1)
130+
#define PC8_ALT1 (PC8 | ALT1)
131+
#define PC9_ALT1 (PC9 | ALT1)
132+
#define PC14_ALT1 (PC14 | ALT1)
133+
134+
#define NUM_DIGITAL_PINS 61
135+
#define NUM_ANALOG_INPUTS 15
136+
137+
// On-board LED pin number
138+
#define LED1 PA5
139+
#define LED2 PC9
140+
#define LED_GREEN LED1
141+
#define LED_BLUE LED2
142+
#ifndef LED_BUILTIN
143+
#define LED_BUILTIN LED_GREEN
144+
#endif
145+
146+
// On-board user button
147+
#ifndef USER_BTN
148+
#define USER_BTN PC13
149+
#endif
150+
151+
// Timer Definitions
152+
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
153+
#ifndef TIMER_TONE
154+
#define TIMER_TONE TIM14
155+
#endif
156+
#ifndef TIMER_SERVO
157+
#define TIMER_SERVO TIM16
158+
#endif
159+
160+
// UART Definitions
161+
#ifndef SERIAL_UART_INSTANCE
162+
#define SERIAL_UART_INSTANCE 2
163+
#endif
164+
165+
// Default pin used for generic 'Serial' instance
166+
// Mandatory for Firmata
167+
#ifndef PIN_SERIAL_RX
168+
#define PIN_SERIAL_RX PA3
169+
#endif
170+
#ifndef PIN_SERIAL_TX
171+
#define PIN_SERIAL_TX PA2
172+
#endif
173+
174+
#define HSE_VALUE (8000000U) /*!< Value of the External oscillator in Hz */
175+
176+
/*----------------------------------------------------------------------------
177+
* Arduino objects - C++ only
178+
*----------------------------------------------------------------------------*/
179+
180+
#ifdef __cplusplus
181+
// These serial port names are intended to allow libraries and architecture-neutral
182+
// sketches to automatically default to the correct port name for a particular type
183+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
184+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
185+
//
186+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
187+
//
188+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
189+
//
190+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
191+
//
192+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
193+
//
194+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
195+
// pins are NOT connected to anything by default.
196+
#ifndef SERIAL_PORT_MONITOR
197+
#define SERIAL_PORT_MONITOR Serial
198+
#endif
199+
#ifndef SERIAL_PORT_HARDWARE
200+
#define SERIAL_PORT_HARDWARE Serial
201+
#endif
202+
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.