Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




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 ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists