Commit 6e997732 authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana

bootloader: FreeRTOS app now boots properly

The issue was the SysTick timer, which was configured by the bootloader to
blink the backlight LEDs, but was not de-configured before booting to the
application.

Without the SysTick timer de-configured, the FreeRTOS tick timer, which relies
on the SysTick timer, fired before FreeRTOS could be properly configured. Since
the FreeRTOS SysTick handler contains some OS-specific functions and data, the
fact that these were not initialized probably led to a segfault.

This issue was fixed in boot.c, by de-configuring the SysTick timer.
parent 4c0752ca
......@@ -153,6 +153,12 @@ void BOOT_boot(void)
CMU->LFCLKSEL = _CMU_LFCLKSEL_RESETVALUE;
CMU->LFACLKEN0 = _CMU_LFACLKEN0_RESETVALUE;
/*
* Disable SysTick timer (bits TICKINT and ENABLE in SysTick.CTRL -- see
* EFM32 Cortex-M3 Reference Manual)
*/
SysTick->CTRL &= ~0x3;
/* Set new vector table pointer */
SCB->VTOR = (uint32_t)BOOTLOADER_SIZE;
......
......@@ -145,8 +145,8 @@ int main(void)
int j;
#if !defined( SIMULATE_SWDCLK_PIN_HI )
/* Listen button BR and enter bootloader mode if pressed */
while (GPIO_PinInGet(gpioPortA, 8))
/* Listen button TL and enter bootloader mode if pressed */
while (GPIO_PinInGet(gpioPortC, 7))
{
USB_PUTS( "SWDCLK is low\r\n" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment