Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

FreeRTOS in Bootloader

Posted by joehinkle on September 16, 2016

Several of my cpu's peripherals (SPI, I2C, ENET) utilize FreeRTOS tasks so When I designed my Bootloader I need FreeRTOS running to utilize those components.

When the time comes to jump from the Bootloader (FreeRTOS tasks running) into the Main Application (which also uses FreeRTOS) -- What do I need to do from the FreeRTOS perspective to perform the leap?

  1. Disable all HW peripheral interrupts that were enabled in the Bootloader.
  2. Disable HW interrupts (I'm using an ARM so ("cpsid i"));

  3. Best way to disable Tic Timer?

  4. Any thing else from FreeRtos's point of view?

Thanks.

Joe


FreeRTOS in Bootloader

Posted by rtel on September 16, 2016

I've been doing this quite a bit myself, and haven't found any issues that you would not find in a bare metal (non RTOS) application - so really FreeRTOS doesn't add any complexity. As per a non RTOS application you need to jump to the start up code of the application being booted, so it initialises its variables etc, (not jump to main() of the application being booted), set up the vector table base address (so the vector table of the application is used, not the vector table of the bootloader), etc, etc.

In addition to disabling interrupts of any peripherals that were enabled by the bootloader you will also need to somehow disable the systick interrupt - but for a belt and braces approach I tend to globally disable interrupts too before jumping to the application ("cpsid i").

Regards.


FreeRTOS in Bootloader

Posted by amcolex on October 9, 2016

I recently wrote a bootloader for my project, and like you, I also use FreeRTOS in the bootloader and the application.

Here is my jump function:

~~~

define START_ADDRESS 0x08018200 // change accordingly

typedef void (*p_function)(void);

void jumptoapplication(void) { uint8t i; uint32t jumpaddress = *(__IO uint32t*)(STARTADDRESS + 4); pfunction pjumpfunction = (pfunction)jumpaddress;

// stop all interrupts
__disable_irq();

// Disable IRQs
for(i = 0;i < 8;i++)
{
    NVIC->ICER[i] = 0xFFFFFFFF;
}
// Clear pending IRQs
for(i = 0;i < 8;i++)
{
    NVIC->ICPR[i] = 0xFFFFFFFF;
}

// enable all interrupts
__enable_irq();

__set_CONTROL(0);

// re-init stack pointer (first entry of the vector table)
__set_MSP(*(__IO uint32_t*)START_ADDRESS);

//jump!
p_jump_function();

} ~~~


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner