Skip to content

Commit 21a2123

Browse files
authored
Merge pull request #2669 from andreaslarssonublox/updated_master
Target - Add u-blox C029 target
2 parents e014b0f + dba6278 commit 21a2123

File tree

15 files changed

+185
-310
lines changed

15 files changed

+185
-310
lines changed

hal/targets.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,13 +1197,13 @@
11971197
"UBLOX_C029": {
11981198
"supported_form_factors": ["ARDUINO"],
11991199
"core": "Cortex-M4F",
1200-
"default_toolchain": "uARM",
1200+
"default_toolchain": "ARM",
12011201
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "IAR"],
12021202
"extra_labels": ["STM", "STM32F4", "STM32F439", "STM32F439ZI"],
1203-
"macros": ["HSE_VALUE=24000000", "HSE_STARTUP_TIMEOUT=5000"],
1203+
"macros": ["HSE_VALUE=24000000", "HSE_STARTUP_TIMEOUT=5000", "CB_INTERFACE_SDIO","CB_CHIP_WL18XX","SUPPORT_80211D_ALWAYS","WLAN_ENABLED"],
12041204
"inherits": ["Target"],
1205-
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
1206-
"default_lib": "small"
1205+
"device_has": ["ANALOGIN", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
1206+
"release_versions": ["5"]
12071207
},
12081208
"NZ32_SC151": {
12091209
"inherits": ["Target"],

hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/TOOLCHAIN_ARM_STD/startup_stm32f439xx.S

Lines changed: 7 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
;******************** (C) COPYRIGHT 2014 STMicroelectronics ********************
1+
;******************** (C) COPYRIGHT 2015 STMicroelectronics ********************
22
;* File Name : startup_stm32f439xx.s
33
;* Author : MCD Application Team
4-
;* Version : V2.1.0
5-
;* Date : 19-June-2014
6-
;* Description : STM32F439x devices vector table for MDK-ARM toolchain.
4+
;* Version : V2.4.0
5+
;* Date : 14-August-2015
6+
;* Description : STM32F439x devices vector table for MDK-ARM_STD toolchain.
77
;* This module performs:
88
;* - Set the initial SP
99
;* - Set the initial PC == Reset_Handler
@@ -39,29 +39,7 @@
3939
;
4040
;*******************************************************************************
4141

42-
; Amount of memory (in bytes) allocated for Stack
43-
; Tailor this value to your application needs
44-
; <h> Stack Configuration
45-
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
46-
; </h>
47-
48-
Stack_Size EQU 0x00000400
49-
50-
AREA STACK, NOINIT, READWRITE, ALIGN=3
51-
Stack_Mem SPACE Stack_Size
52-
__initial_sp
53-
54-
55-
; <h> Heap Configuration
56-
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
57-
; </h>
58-
59-
Heap_Size EQU 0x00000200
60-
61-
AREA HEAP, NOINIT, READWRITE, ALIGN=3
62-
__heap_base
63-
Heap_Mem SPACE Heap_Size
64-
__heap_limit
42+
__initial_sp EQU 0x20020000 ; Top of RAM
6543

6644
PRESERVE8
6745
THUMB
@@ -326,7 +304,7 @@ Default_Handler PROC
326304
EXPORT OTG_HS_WKUP_IRQHandler [WEAK]
327305
EXPORT OTG_HS_IRQHandler [WEAK]
328306
EXPORT DCMI_IRQHandler [WEAK]
329-
EXPORT CRYP_IRQHandler [WEAK]
307+
EXPORT CRYP_IRQHandler [WEAK]
330308
EXPORT HASH_RNG_IRQHandler [WEAK]
331309
EXPORT FPU_IRQHandler [WEAK]
332310
EXPORT UART7_IRQHandler [WEAK]
@@ -435,33 +413,6 @@ DMA2D_IRQHandler
435413
ENDP
436414

437415
ALIGN
438-
439-
;*******************************************************************************
440-
; User Stack and Heap initialization
441-
;*******************************************************************************
442-
IF :DEF:__MICROLIB
443-
444-
EXPORT __initial_sp
445-
EXPORT __heap_base
446-
EXPORT __heap_limit
447-
448-
ELSE
449-
450-
IMPORT __use_two_region_memory
451-
EXPORT __user_initial_stackheap
452-
453-
__user_initial_stackheap
454-
455-
LDR R0, = Heap_Mem
456-
LDR R1, =(Stack_Mem + Stack_Size)
457-
LDR R2, = (Heap_Mem + Heap_Size)
458-
LDR R3, = Stack_Mem
459-
BX LR
460-
461-
ALIGN
462-
463-
ENDIF
464-
465-
END
416+
END
466417

467418
;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****

hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/TOOLCHAIN_ARM_STD/stm32f439xx.sct

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; Scatter-Loading Description File
22
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3-
; Copyright (c) 2014, STMicroelectronics
3+
; Copyright (c) 2015, STMicroelectronics
44
; All rights reserved.
55
;
66
; Redistribution and use in source and binary forms, with or without
@@ -27,10 +27,10 @@
2727
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2929

30-
; STM32F439ZI: 512 KB FLASH (0x80000) + 256 KB SRAM (0x30000 + 0x10000)
31-
LR_IROM1 0x08000000 0x80000 { ; load region size_region
30+
; 2 MB FLASH (0x200000) + 256 KB SRAM (0x30000 + 0x10000)
31+
LR_IROM1 0x08000000 0x200000 { ; load region size_region
3232

33-
ER_IROM1 0x08000000 0x80000 { ; load address = execution address
33+
ER_IROM1 0x08000000 0x200000 { ; load address = execution address
3434
*.o (RESET, +First)
3535
*(InRoot$$Sections)
3636
.ANY (+RO)
@@ -41,7 +41,7 @@ LR_IROM1 0x08000000 0x80000 { ; load region size_region
4141
.ANY (+RW +ZI)
4242
}
4343

44-
RW_IRAM1 (0x10000000) (0x10000) { ; RW data
44+
RW_IRAM2 (0x10000000) (0x10000) { ; RW data
4545
.ANY (+RW +ZI)
4646
}
4747
}

hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/TOOLCHAIN_GCC_ARM/STM32F439ZI.ld

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* Linker script to configure memory regions. */
22
MEMORY
33
{
4-
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
5-
RAM (rwx) : ORIGIN = 0x200001AC, LENGTH = 192k - 0x1AC
6-
RAM2 (rwx) : ORIGIN = 0x10000000, LENGTH = 64k
4+
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048k
5+
CCM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K
6+
RAM (rwx) : ORIGIN = 0x200001AC, LENGTH = 192k - 0x1AC
77
}
88

99
/* Linker script to place sections and symbol values. Should be used together

hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/TOOLCHAIN_GCC_ARM/startup_stm32f439xx.S

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,14 @@ LoopFillZerobss:
110110
/* Call the clock system intitialization function.*/
111111
bl SystemInit
112112
/* Call static constructors */
113-
bl __libc_init_array
113+
//bl __libc_init_array
114114
/* Call the application's entry point.*/
115-
bl main
115+
//bl main
116+
// Calling the crt0 'cold-start' entry point. There __libc_init_array is called
117+
// and when existing hardware_init_hook() and software_init_hook() before
118+
// starting main(). software_init_hook() is available and has to be called due
119+
// to initializsation when using rtos.
120+
bl _start
116121
bx lr
117122
.size Reset_Handler, .-Reset_Handler
118123

hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/TOOLCHAIN_IAR/stm32f439xx_flash.icf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ define symbol __ICFEDIT_intvec_start__ = 0x08000000;
66
/*-Memory Regions-*/
77
define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
88
define symbol __ICFEDIT_region_ROM_end__ = 0x081FFFFF;
9-
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
9+
define symbol __ICFEDIT_region_NVIC_start__ = 0x20000000;
10+
define symbol __ICFEDIT_region_NVIC_end__ = 0x200001AF;
11+
define symbol __ICFEDIT_region_RAM_start__ = 0x200001B0;
1012
define symbol __ICFEDIT_region_RAM_end__ = 0x2002FFFF;
1113
define symbol __ICFEDIT_region_CCMRAM_start__ = 0x10000000;
1214
define symbol __ICFEDIT_region_CCMRAM_end__ = 0x1000FFFF;

hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/hal_tick.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ void timer_irq_handler(void) {
6969

7070
// Reconfigure the HAL tick using a standard timer instead of systick.
7171
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
72+
RCC_ClkInitTypeDef RCC_ClkInitStruct;
73+
uint32_t PclkFreq;
74+
75+
// Get clock configuration
76+
// Note: PclkFreq contains here the Latency (not used after)
77+
HAL_RCC_GetClockConfig(&RCC_ClkInitStruct, &PclkFreq);
78+
79+
// Get TIM5 clock value
80+
PclkFreq = HAL_RCC_GetPCLK1Freq();
81+
7282
// Enable timer clock
7383
TIM_MST_RCC;
7484

@@ -79,8 +89,14 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
7989
// Configure time base
8090
TimMasterHandle.Instance = TIM_MST;
8191
TimMasterHandle.Init.Period = 0xFFFFFFFF;
82-
TimMasterHandle.Init.Prescaler = (uint32_t)( SystemCoreClock / 1000000) - 1; // 1 us tick
83-
TimMasterHandle.Init.ClockDivision = 0;
92+
93+
// TIMxCLK = PCLKx when the APB prescaler = 1 else TIMxCLK = 2 * PCLKx
94+
if (RCC_ClkInitStruct.APB1CLKDivider == RCC_HCLK_DIV1)
95+
TimMasterHandle.Init.Prescaler = (uint16_t)((PclkFreq) / 1000000) - 1; // 1 us tick
96+
else
97+
TimMasterHandle.Init.Prescaler = (uint16_t)((PclkFreq * 2) / 1000000) - 1; // 1 us tick
98+
99+
TimMasterHandle.Init.ClockDivision = 0;
84100
TimMasterHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
85101
TimMasterHandle.Init.RepetitionCounter = 0;
86102
HAL_TIM_OC_Init(&TimMasterHandle);

hal/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_C029/hal_tick.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151

5252
#define HAL_TICK_DELAY (1000) // 1 ms
5353

54+
void HAL_SuspendTick(void);
55+
5456
#ifdef __cplusplus
5557
}
5658
#endif

0 commit comments

Comments
 (0)