Skip to content

Commit 173486f

Browse files
author
andreas.larsson
committed
Added u-blox C029 target
1 parent e9d0fbd commit 173486f

File tree

12 files changed

+170
-248
lines changed

12 files changed

+170
-248
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_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/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)