Skip to content

Commit ea6e7a0

Browse files
authored
Update ARMED_V1 variant (#990)
Add PWM to PA3, PA10 and PD12 Update ldscript.ld Update SystemClock_Config() Fix upload.maximum_size and upload.maximum_data_size
1 parent f5be507 commit ea6e7a0

File tree

4 files changed

+98
-68
lines changed

4 files changed

+98
-68
lines changed

boards.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,8 +1576,8 @@ LoRa.menu.upload_method.dfuMethod.upload.tool=stm32CubeProg
15761576

15771577
# ARMED_V1 board
15781578
3dprinter.menu.pnum.ARMED_V1=Armed V1
1579-
3dprinter.menu.pnum.ARMED_V1.upload.maximum_size=1048576
1580-
3dprinter.menu.pnum.ARMED_V1.upload.maximum_data_size=196608
1579+
3dprinter.menu.pnum.ARMED_V1.upload.maximum_size=524288
1580+
3dprinter.menu.pnum.ARMED_V1.upload.maximum_data_size=131072
15811581
3dprinter.menu.pnum.ARMED_V1.build.mcu=cortex-m4
15821582
3dprinter.menu.pnum.ARMED_V1.build.flags.fp=-mfpu=fpv4-sp-d16 -mfloat-abi=hard
15831583
3dprinter.menu.pnum.ARMED_V1.build.board=ARMED_V1

variants/ARMED_V1/PeripheralPins.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ WEAK const PinMap PinMap_PWM[] = {
128128
{PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3
129129
// {PA_2, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3
130130
// {PA_2, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1
131-
// {PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4
131+
{PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4
132132
// {PA_3, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4
133133
// {PA_3, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2
134134
// {PA_5, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 - SPI
@@ -141,7 +141,7 @@ WEAK const PinMap PinMap_PWM[] = {
141141
// {PA_7, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1 - SPI
142142
// {PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1
143143
// {PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 - USB
144-
// {PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 - USB
144+
{PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 - USB
145145
// {PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 - USB
146146
// {PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
147147
// {PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N
@@ -176,7 +176,7 @@ WEAK const PinMap PinMap_PWM[] = {
176176
// {PC_8, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 0)}, // TIM8_CH3
177177
{PC_9, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4
178178
// {PC_9, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 4, 0)}, // TIM8_CH4
179-
// {PD_12, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 - LED4 Green
179+
{PD_12, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 - LED4 Green
180180
// {PD_13, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 - LED3 Orange
181181
// {PD_14, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 - LED5 Red
182182
// {PD_15, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 - LED6 Blue

variants/ARMED_V1/ldscript.ld

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@
1414
**
1515
** Target : STMicroelectronics STM32
1616
**
17-
**
18-
** Distribution: The file is distributed as is, without any warranty
17+
** Distribution: The file is distributed “as is,” without any warranty
1918
** of any kind.
2019
**
2120
*****************************************************************************
2221
** @attention
2322
**
24-
** <h2><center>&copy; COPYRIGHT(c) 2014 Ac6</center></h2>
23+
** <h2><center>&copy; COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
2524
**
2625
** Redistribution and use in source and binary forms, with or without modification,
2726
** are permitted provided that the following conditions are met:
@@ -30,7 +29,7 @@
3029
** 2. Redistributions in binary form must reproduce the above copyright notice,
3130
** this list of conditions and the following disclaimer in the documentation
3231
** and/or other materials provided with the distribution.
33-
** 3. Neither the name of Ac6 nor the names of its contributors
32+
** 3. Neither the name of STMicroelectronics nor the names of its contributors
3433
** may be used to endorse or promote products derived from this software
3534
** without specific prior written permission.
3635
**
@@ -54,14 +53,15 @@ ENTRY(Reset_Handler)
5453
/* Highest address of the user mode stack */
5554
_estack = 0x20020000; /* end of RAM */
5655
/* Generate a link error if heap and stack don't fit into RAM */
57-
_Min_Heap_Size = 0x200;; /* required amount of heap */
58-
_Min_Stack_Size = 0x400;; /* required amount of stack */
56+
_Min_Heap_Size = 0x200; /* required amount of heap */
57+
_Min_Stack_Size = 0x400; /* required amount of stack */
5958

6059
/* Specify the memory areas */
6160
MEMORY
6261
{
63-
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K
6462
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
63+
CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K
64+
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K
6565
}
6666

6767
/* Define output sections */
@@ -76,7 +76,7 @@ SECTIONS
7676
} >FLASH
7777

7878
/* The program code and other data goes into FLASH */
79-
.text ALIGN(4):
79+
.text :
8080
{
8181
. = ALIGN(4);
8282
*(.text) /* .text sections (code) */
@@ -93,7 +93,7 @@ SECTIONS
9393
} >FLASH
9494

9595
/* Constant data goes into FLASH */
96-
.rodata ALIGN(4):
96+
.rodata :
9797
{
9898
. = ALIGN(4);
9999
*(.rodata) /* .rodata sections (constants, strings, etc.) */
@@ -133,7 +133,7 @@ SECTIONS
133133
_sidata = LOADADDR(.data);
134134

135135
/* Initialized data sections goes into RAM, load LMA copy after code */
136-
.data :
136+
.data :
137137
{
138138
. = ALIGN(4);
139139
_sdata = .; /* create a global symbol at data start */
@@ -144,7 +144,25 @@ SECTIONS
144144
_edata = .; /* define a global symbol at data end */
145145
} >RAM AT> FLASH
146146

147-
/*_siccmram = LOADADDR(.ccmram);*/
147+
_siccmram = LOADADDR(.ccmram);
148+
149+
/* CCM-RAM section
150+
*
151+
* IMPORTANT NOTE!
152+
* If initialized variables will be placed in this section,
153+
* the startup code needs to be modified to copy the init-values.
154+
*/
155+
.ccmram :
156+
{
157+
. = ALIGN(4);
158+
_sccmram = .; /* create a global symbol at ccmram start */
159+
*(.ccmram)
160+
*(.ccmram*)
161+
162+
. = ALIGN(4);
163+
_eccmram = .; /* create a global symbol at ccmram end */
164+
} >CCMRAM AT> FLASH
165+
148166

149167
/* Uninitialized data section */
150168
. = ALIGN(4);
@@ -165,15 +183,15 @@ SECTIONS
165183
/* User_heap_stack section, used to check that there is enough RAM left */
166184
._user_heap_stack :
167185
{
168-
. = ALIGN(4);
186+
. = ALIGN(8);
169187
PROVIDE ( end = . );
170188
PROVIDE ( _end = . );
171189
. = . + _Min_Heap_Size;
172190
. = . + _Min_Stack_Size;
173-
. = ALIGN(4);
191+
. = ALIGN(8);
174192
} >RAM
175193

176-
194+
177195

178196
/* Remove information from the standard libraries */
179197
/DISCARD/ :

variants/ARMED_V1/variant.cpp

Lines changed: 61 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
11
/*
2-
Copyright (c) 2011 Arduino. All right reserved.
3-
4-
This library is free software; you can redistribute it and/or
5-
modify it under the terms of the GNU Lesser General Public
6-
License as published by the Free Software Foundation; either
7-
version 2.1 of the License, or (at your option) any later version.
8-
9-
This library is distributed in the hope that it will be useful,
10-
but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12-
See the GNU Lesser General Public License for more details.
13-
14-
You should have received a copy of the GNU Lesser General Public
15-
License along with this library; if not, write to the Free Software
16-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2+
*******************************************************************************
3+
* Copyright (c) 2017, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice,
10+
* this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
15+
* may be used to endorse or promote products derived from this software
16+
* without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*******************************************************************************
1729
*/
1830

1931
#include "pins_arduino.h"
@@ -117,40 +129,38 @@ extern "C" {
117129
#endif
118130

119131
/**
120-
* @brief System Clock Configuration
121-
* The system Clock is configured as follow :
122-
* System Clock source = PLL (HSE)
123-
* SYSCLK(Hz) = 168000000
124-
* HCLK(Hz) = 168000000
125-
* AHB Prescaler = 1
126-
* APB1 Prescaler = 4
127-
* APB2 Prescaler = 2
128-
* HSE Frequency(Hz) = 8000000
129-
* PLL_M = 8
130-
* PLL_N = 336
131-
* PLL_P = 2
132-
* PLL_Q = 7
133-
* VDD(V) = 3.3
134-
* Main regulator output voltage = Scale1 mode
135-
* Flash Latency(WS) = 5
136-
* @param None
137-
* @retval None
138-
*/
132+
* @brief System Clock Configuration
133+
* The system Clock is configured as follow :
134+
* System Clock source = PLL (HSE)
135+
* SYSCLK(Hz) = 168000000
136+
* HCLK(Hz) = 168000000
137+
* AHB Prescaler = 1
138+
* APB1 Prescaler = 4
139+
* APB2 Prescaler = 2
140+
* HSE Frequency(Hz) = 8000000
141+
* PLL_M = 8
142+
* PLL_N = 336
143+
* PLL_P = 2
144+
* PLL_Q = 7
145+
* VDD(V) = 3.3
146+
* Main regulator output voltage = Scale1 mode
147+
* Flash Latency(WS) = 5
148+
* @param None
149+
* @retval None
150+
*/
139151
WEAK void SystemClock_Config(void)
140152
{
141153
RCC_ClkInitTypeDef RCC_ClkInitStruct;
142154
RCC_OscInitTypeDef RCC_OscInitStruct;
143155

144-
145-
/* Enable Power Control clock */
156+
/**Configure the main internal regulator output voltage
157+
*/
146158
__HAL_RCC_PWR_CLK_ENABLE();
147159

148-
#ifdef HAL_PWR_MODULE_ENABLED
149160
/* The voltage scaling allows optimizing the power consumption when the device is
150-
clocked below the maximum system frequency, to update the voltage scaling value
151-
regarding system frequency refer to product datasheet. */
161+
clocked below the maximum system frequency, to update the voltage scaling value
162+
regarding system frequency refer to product datasheet. */
152163
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
153-
#endif
154164

155165
/* Enable HSE Oscillator and activate PLL with HSE as source */
156166
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
@@ -161,23 +171,25 @@ WEAK void SystemClock_Config(void)
161171
RCC_OscInitStruct.PLL.PLLN = 336;
162172
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
163173
RCC_OscInitStruct.PLL.PLLQ = 7;
164-
HAL_RCC_OscConfig(&RCC_OscInitStruct);
174+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
175+
_Error_Handler(__FILE__, __LINE__);
176+
}
165177

166178
/* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
167-
clocks dividers */
168-
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK |
169-
RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
179+
clocks dividers */
180+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK |
181+
RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
170182
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
171183
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
172184
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
173185
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
174-
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5);
175186

176-
/* STM32F405x/407x/415x/417x Revision Z devices: prefetch is supported */
177-
if (HAL_GetREVID() == 0x1001) {
178-
/* Enable the Flash prefetch */
179-
__HAL_FLASH_PREFETCH_BUFFER_ENABLE();
187+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) {
188+
_Error_Handler(__FILE__, __LINE__);
180189
}
190+
191+
/* Ensure CCM RAM clock is enabled */
192+
__HAL_RCC_CCMDATARAMEN_CLK_ENABLE();
181193
}
182194

183195
#ifdef __cplusplus

0 commit comments

Comments
 (0)