Skip to content

Commit 537eeb2

Browse files
authored
fix(CMSIS): Call PinInit from SystemInit in RISC-V startup (#1430)
Signed-off-by: Michael Perkins <[email protected]>
1 parent 3a9dc57 commit 537eeb2

File tree

23 files changed

+157
-85
lines changed

23 files changed

+157
-85
lines changed

Libraries/CMSIS/Device/Maxim/MAX32520/Source/system_max32520.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
44
* Analog Devices, Inc.),
5-
* Copyright (C) 2023-2024 Analog Devices, Inc.
5+
* Copyright (C) 2023-2025 Analog Devices, Inc.
66
*
77
* Licensed under the Apache License, Version 2.0 (the "License");
88
* you may not use this file except in compliance with the License.
@@ -81,7 +81,7 @@ __weak void SystemCoreClockUpdate(void)
8181
* implemented by the application for early initializations. If a value other
8282
* than '0' is returned, the C runtime initialization will be skipped.
8383
*
84-
* You may over-ride this function in your program by defining a custom
84+
* You may override this function in your program by defining a custom
8585
* PreInit(), but care should be taken to reproduce the initialization steps
8686
* or a non-functional system may result.
8787
*/
@@ -92,7 +92,7 @@ __weak int PreInit(void)
9292
}
9393

9494
/* This function is called before the Board_Init function. This weak
95-
* implementation does nothing, but you may over-ride this function in your
95+
* implementation does nothing, but you may override this function in your
9696
* program if you want to configure the state of all pins prior to the
9797
* application running. This is useful when using external tools (like a
9898
* Pin Mux configuration tool) that generate code to initialize the pins.
@@ -117,7 +117,7 @@ __weak int Board_Init(void)
117117

118118
/* This function is called just before control is transferred to main().
119119
*
120-
* You may over-ride this function in your program by defining a custom
120+
* You may override this function in your program by defining a custom
121121
* SystemInit(), but care should be taken to reproduce the initialization
122122
* steps or a non-functional system may result.
123123
*/

Libraries/CMSIS/Device/Maxim/MAX32570/Source/system_max32570.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
44
* Analog Devices, Inc.),
5-
* Copyright (C) 2023-2024 Analog Devices, Inc.
5+
* Copyright (C) 2023-2025 Analog Devices, Inc.
66
*
77
* Licensed under the Apache License, Version 2.0 (the "License");
88
* you may not use this file except in compliance with the License.
@@ -87,7 +87,7 @@ __weak void SystemCoreClockUpdate(void)
8787
* implemented by the application for early initializations. If a value other
8888
* than '0' is returned, the C runtime initialization will be skipped.
8989
*
90-
* You may over-ride this function in your program by defining a custom
90+
* You may override this function in your program by defining a custom
9191
* PreInit(), but care should be taken to reproduce the initialization steps
9292
* or a non-functional system may result.
9393
*/
@@ -98,7 +98,7 @@ __weak int PreInit(void)
9898
}
9999

100100
/* This function is called before the Board_Init function. This weak
101-
* implementation does nothing, but you may over-ride this function in your
101+
* implementation does nothing, but you may override this function in your
102102
* program if you want to configure the state of all pins prior to the
103103
* application running. This is useful when using external tools (like a
104104
* Pin Mux configuration tool) that generate code to initialize the pins.
@@ -123,7 +123,7 @@ __weak int Board_Init(void)
123123

124124
/* This function is called just before control is transferred to main().
125125
*
126-
* You may over-ride this function in your program by defining a custom
126+
* You may override this function in your program by defining a custom
127127
* SystemInit(), but care should be taken to reproduce the initialization
128128
* steps or a non-functional system may result.
129129
*/

Libraries/CMSIS/Device/Maxim/MAX32572/Source/system_max32572.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
44
* Analog Devices, Inc.),
5-
* Copyright (C) 2023-2024 Analog Devices, Inc.
5+
* Copyright (C) 2023-2025 Analog Devices, Inc.
66
*
77
* Licensed under the Apache License, Version 2.0 (the "License");
88
* you may not use this file except in compliance with the License.
@@ -87,7 +87,7 @@ __weak void SystemCoreClockUpdate(void)
8787
* implemented by the application for early initializations. If a value other
8888
* than '0' is returned, the C runtime initialization will be skipped.
8989
*
90-
* You may over-ride this function in your program by defining a custom
90+
* You may override this function in your program by defining a custom
9191
* PreInit(), but care should be taken to reproduce the initialization steps
9292
* or a non-functional system may result.
9393
*/
@@ -98,7 +98,7 @@ __weak int PreInit(void)
9898
}
9999

100100
/* This function is called before the Board_Init function. This weak
101-
* implementation does nothing, but you may over-ride this function in your
101+
* implementation does nothing, but you may override this function in your
102102
* program if you want to configure the state of all pins prior to the
103103
* application running. This is useful when using external tools (like a
104104
* Pin Mux configuration tool) that generate code to initialize the pins.
@@ -123,7 +123,7 @@ __weak int Board_Init(void)
123123

124124
/* This function is called just before control is transferred to main().
125125
*
126-
* You may over-ride this function in your program by defining a custom
126+
* You may override this function in your program by defining a custom
127127
* SystemInit(), but care should be taken to reproduce the initialization
128128
* steps or a non-functional system may result.
129129
*/

Libraries/CMSIS/Device/Maxim/MAX32572/Source/system_riscv_max32572.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
44
* Analog Devices, Inc.),
5-
* Copyright (C) 2023-2024 Analog Devices, Inc.
5+
* Copyright (C) 2023-2025 Analog Devices, Inc.
66
*
77
* Licensed under the Apache License, Version 2.0 (the "License");
88
* you may not use this file except in compliance with the License.
@@ -84,7 +84,7 @@ __weak void SystemCoreClockUpdate(void)
8484
* implemented by the application for early initializations. If a value other
8585
* than '0' is returned, the C runtime initialization will be skipped.
8686
*
87-
* You may over-ride this function in your program by defining a custom
87+
* You may override this function in your program by defining a custom
8888
* PreInit(), but care should be taken to reproduce the initilization steps
8989
* or a non-functional system may result.
9090
*/
@@ -94,6 +94,17 @@ __weak int PreInit(void)
9494
return 0;
9595
}
9696

97+
/* This function is called before the Board_Init function. This weak
98+
* implementation does nothing, but you may override this function in your
99+
* program if you want to configure the state of all pins prior to the
100+
* application running. This is useful when using external tools (like a
101+
* Pin Mux configuration tool) that generate code to initialize the pins.
102+
*/
103+
__weak void PinInit(void)
104+
{
105+
/* Do nothing */
106+
}
107+
97108
__weak int PeripheralInit(void)
98109
{
99110
/* Do nothing */
@@ -115,7 +126,7 @@ void __enable_irq(void)
115126

116127
/* This function is called just before control is transferred to main().
117128
*
118-
* You may over-ride this function in your program by defining a custom
129+
* You may override this function in your program by defining a custom
119130
* SystemInit(), but care should be taken to reproduce the initialization
120131
* steps or a non-functional system may result.
121132
*/
@@ -125,6 +136,7 @@ __weak void SystemInit(void)
125136

126137
__enable_irq();
127138

139+
PinInit();
128140
Board_Init();
129141

130142
/* Call peripheral init after board init to ensure the user's configuration

Libraries/CMSIS/Device/Maxim/MAX32650/Source/system_max32650.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
44
* Analog Devices, Inc.),
5-
* Copyright (C) 2023-2024 Analog Devices, Inc.
5+
* Copyright (C) 2023-2025 Analog Devices, Inc.
66
*
77
* Licensed under the Apache License, Version 2.0 (the "License");
88
* you may not use this file except in compliance with the License.
@@ -85,7 +85,7 @@ __weak void SystemCoreClockUpdate(void)
8585
* implemented by the application for early initializations. If a value other
8686
* than '0' is returned, the C runtime initialization will be skipped.
8787
*
88-
* You may over-ride this function in your program by defining a custom
88+
* You may override this function in your program by defining a custom
8989
* PreInit(), but care should be taken to reproduce the initialization steps
9090
* or a non-functional system may result.
9191
*/
@@ -97,7 +97,7 @@ __weak int PreInit(void)
9797
}
9898

9999
/* This function is called before the Board_Init function. This weak
100-
* implementation does nothing, but you may over-ride this function in your
100+
* implementation does nothing, but you may override this function in your
101101
* program if you want to configure the state of all pins prior to the
102102
* application running. This is useful when using external tools (like a
103103
* Pin Mux configuration tool) that generate code to initialize the pins.
@@ -122,7 +122,7 @@ __weak int Board_Init(void)
122122

123123
/* This function is called just before control is transferred to main().
124124
*
125-
* You may over-ride this function in your program by defining a custom
125+
* You may override this function in your program by defining a custom
126126
* SystemInit(), but care should be taken to reproduce the initialization
127127
* steps or a non-functional system may result.
128128
*/

Libraries/CMSIS/Device/Maxim/MAX32655/Source/system_max32655.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
44
* Analog Devices, Inc.),
5-
* Copyright (C) 2023-2024 Analog Devices, Inc.
5+
* Copyright (C) 2023-2025 Analog Devices, Inc.
66
*
77
* Licensed under the Apache License, Version 2.0 (the "License");
88
* you may not use this file except in compliance with the License.
@@ -92,7 +92,7 @@ __weak void SystemCoreClockUpdate(void)
9292
* implemented by the application for early initializations. If a value other
9393
* than '0' is returned, the C runtime initialization will be skipped.
9494
*
95-
* You may over-ride this function in your program by defining a custom
95+
* You may override this function in your program by defining a custom
9696
* PreInit(), but care should be taken to reproduce the initialization steps
9797
* or a non-functional system may result.
9898
*/
@@ -115,7 +115,7 @@ __weak int PreInit(void)
115115
}
116116

117117
/* This function is called before the Board_Init function. This weak
118-
* implementation does nothing, but you may over-ride this function in your
118+
* implementation does nothing, but you may override this function in your
119119
* program if you want to configure the state of all pins prior to the
120120
* application running. This is useful when using external tools (like a
121121
* Pin Mux configuration tool) that generate code to initialize the pins.
@@ -142,7 +142,7 @@ __weak void PalSysInit(void) {}
142142

143143
/* This function is called just before control is transferred to main().
144144
*
145-
* You may over-ride this function in your program by defining a custom
145+
* You may override this function in your program by defining a custom
146146
* SystemInit(), but care should be taken to reproduce the initialization
147147
* steps or a non-functional system may result.
148148
*/

Libraries/CMSIS/Device/Maxim/MAX32655/Source/system_riscv_max32655.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
44
* Analog Devices, Inc.),
5-
* Copyright (C) 2023-2024 Analog Devices, Inc.
5+
* Copyright (C) 2023-2025 Analog Devices, Inc.
66
*
77
* Licensed under the Apache License, Version 2.0 (the "License");
88
* you may not use this file except in compliance with the License.
@@ -734,7 +734,7 @@ void SystemCoreClockUpdate(void)
734734
* implemented by the application for early initializations. If a value other
735735
* than '0' is returned, the C runtime initialization will be skipped.
736736
*
737-
* You may over-ride this function in your program by defining a custom
737+
* You may override this function in your program by defining a custom
738738
* PreInit(), but care should be taken to reproduce the initilization steps
739739
* or a non-functional system may result.
740740
*/
@@ -744,6 +744,17 @@ __weak int PreInit(void)
744744
return 0;
745745
}
746746

747+
/* This function is called before the Board_Init function. This weak
748+
* implementation does nothing, but you may override this function in your
749+
* program if you want to configure the state of all pins prior to the
750+
* application running. This is useful when using external tools (like a
751+
* Pin Mux configuration tool) that generate code to initialize the pins.
752+
*/
753+
__weak void PinInit(void)
754+
{
755+
/* Do nothing */
756+
}
757+
747758
__weak int PeripheralInit(void)
748759
{
749760
/* Do nothing */
@@ -761,7 +772,7 @@ __weak void PalSysInit(void) {}
761772

762773
/* This function is called just before control is transferred to main().
763774
*
764-
* You may over-ride this function in your program by defining a custom
775+
* You may override this function in your program by defining a custom
765776
* SystemInit(), but care should be taken to reproduce the initialization
766777
* steps or a non-functional system may result.
767778
*/
@@ -778,6 +789,7 @@ __weak void SystemInit(void)
778789

779790
__enable_irq();
780791

792+
PinInit();
781793
Board_Init();
782794

783795
/* Call peripheral init after board init to ensure the user's configuration

Libraries/CMSIS/Device/Maxim/MAX32657/Source/system_max32657.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ __weak void SystemCoreClockUpdate(void)
112112
* implemented by the application for early initializations. If a value other
113113
* than '0' is returned, the C runtime initialization will be skipped.
114114
*
115-
* You may over-ride this function in your program by defining a custom
115+
* You may override this function in your program by defining a custom
116116
* PreInit(), but care should be taken to reproduce the initialization steps
117117
* or a non-functional system may result.
118118
*/
@@ -124,7 +124,7 @@ __weak int PreInit(void)
124124

125125
/**
126126
* This function is called before the Board_Init function. This weak
127-
* implementation does nothing, but you may over-ride this function in your
127+
* implementation does nothing, but you may override this function in your
128128
* program if you want to configure the state of all pins prior to the
129129
* application running. This is useful when using external tools (like a
130130
* Pin Mux configuration tool) that generate code to initialize the pins.
@@ -153,7 +153,7 @@ __weak void PalSysInit(void) {}
153153
/**
154154
* This function is called just before control is transferred to main().
155155
*
156-
* You may over-ride this function in your program by defining a custom
156+
* You may override this function in your program by defining a custom
157157
* SystemInit(), but care should be taken to reproduce the initialization
158158
* steps or a non-functional system may result.
159159
*/
@@ -219,7 +219,7 @@ __weak void SystemInit(void)
219219
* is transferred to non-secure world. Only available when
220220
* trustzone feature is used.
221221
*
222-
* You may over-ride this function in your program by defining a custom
222+
* You may override this function in your program by defining a custom
223223
* NonSecure_Init(), but care should be taken to reproduce the initialization
224224
* steps to non-secure code.
225225
*

Libraries/CMSIS/Device/Maxim/MAX32660/Source/system_max32660.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
99
* Analog Devices, Inc.),
10-
* Copyright (C) 2023-2024 Analog Devices, Inc.
10+
* Copyright (C) 2023-2025 Analog Devices, Inc.
1111
*
1212
* Licensed under the Apache License, Version 2.0 (the "License");
1313
* you may not use this file except in compliance with the License.
@@ -87,7 +87,7 @@ __weak void SystemCoreClockUpdate(void)
8787
* implemented by the application for early initializations. If a value other
8888
* than '0' is returned, the C runtime initialization will be skipped.
8989
*
90-
* You may over-ride this function in your program by defining a custom
90+
* You may override this function in your program by defining a custom
9191
* PreInit(), but care should be taken to reproduce the initilization steps
9292
* or a non-functional system may result.
9393
*/
@@ -98,7 +98,7 @@ __weak int PreInit(void)
9898
}
9999

100100
/* This function is called before the Board_Init function. This weak
101-
* implementation does nothing, but you may over-ride this function in your
101+
* implementation does nothing, but you may override this function in your
102102
* program if you want to configure the state of all pins prior to the
103103
* application running. This is useful when using external tools (like a
104104
* Pin Mux configuration tool) that generate code to initialize the pins.
@@ -123,7 +123,7 @@ __weak int Board_Init(void)
123123

124124
/* This function is called just before control is transferred to main().
125125
*
126-
* You may over-ride this function in your program by defining a custom
126+
* You may override this function in your program by defining a custom
127127
* SystemInit(), but care should be taken to reproduce the initialization
128128
* steps or a non-functional system may result.
129129
*/

Libraries/CMSIS/Device/Maxim/MAX32662/Source/system_max32662.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
88
* Analog Devices, Inc.),
9-
* Copyright (C) 2023-2024 Analog Devices, Inc.
9+
* Copyright (C) 2023-2025 Analog Devices, Inc.
1010
*
1111
* Licensed under the Apache License, Version 2.0 (the "License");
1212
* you may not use this file except in compliance with the License.
@@ -110,7 +110,7 @@ __weak void SystemCoreClockUpdate(void)
110110
* implemented by the application for early initializations. If a value other
111111
* than '0' is returned, the C runtime initialization will be skipped.
112112
*
113-
* You may over-ride this function in your program by defining a custom
113+
* You may override this function in your program by defining a custom
114114
* PreInit(), but care should be taken to reproduce the initialization steps
115115
* or a non-functional system may result.
116116
*/
@@ -121,7 +121,7 @@ __weak int PreInit(void)
121121
}
122122

123123
/* This function is called before the Board_Init function. This weak
124-
* implementation does nothing, but you may over-ride this function in your
124+
* implementation does nothing, but you may override this function in your
125125
* program if you want to configure the state of all pins prior to the
126126
* application running. This is useful when using external tools (like a
127127
* Pin Mux configuration tool) that generate code to initialize the pins.
@@ -148,7 +148,7 @@ __weak void PalSysInit(void) {}
148148

149149
/* This function is called just before control is transferred to main().
150150
*
151-
* You may over-ride this function in your program by defining a custom
151+
* You may override this function in your program by defining a custom
152152
* SystemInit(), but care should be taken to reproduce the initialization
153153
* steps or a non-functional system may result.
154154
*/

0 commit comments

Comments
 (0)