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

Bootloader

Posted by Pablo Cremades on March 4, 2010
Hi. I'm working with LPC2368 and Freertos. My application is working fine. Now I need to implement a bootloader to upgrade the firmware from external flash memory (SPI). The first thing I did to test was to write a very simple bootloader that jumps to address 0x1000 (where user application should be). Then I move the application code so that its entry point is 0x1000. I did that by modifying the memory map, setting flash starting address at 0x1000. The application compiled ok, and was loaded at 0x1000. The problem is that it keeps reseting. I followed the code step by step, and the problem seems to be in function:
void vPortISRStartFirstTask( void )
{
/* Simply start the scheduler. This is included here as it can only be
called from ARM mode. */
portRESTORE_CONTEXT();
}

when the call to portRESTORE_CONTEXT() is made, the application restarts.

Any idea how to make this work?

Thanks.

RE: Bootloader

Posted by MEdwards on March 4, 2010
Check that the LPC is in Supervisor mode before portRESTORE_CONTEXT() is called. It will crash on that function if it is not.

RE: Bootloader

Posted by Pablo Cremades on March 5, 2010
Thanks for your reply. The processor is in Supervisor Mode befor portRESTORE_CONTEXT() is called. Actually, crt0.s makes the processor switch to supervisor mode befor the main application is called.

RE: Bootloader

Posted by Preet Kang on March 9, 2010
FreeRTOS should be independent of flash offset defined by your application. I am using secondary bootloader for LPC2148 and it is working just fine. Try running an application without FreeRTOS, if that works, then there's no reason why FreeRTOS shouldn't.

Bootloader

Posted by ruggerobandera on October 21, 2016

I'm using FreeRTOS V8.2.3 and a STM32746G with the discovery board. I create a simple FreeRTOS application and all works fine. Now I create a Simple Bootloader (no RTOS) The Simple Bootloader is mapped ta 0x08000000 my Application is mapped 0x08010000. After the jump below the code I used

~~~ typedef void (pfunction)(void); // address == 0x08010000. void JmpToAddress(unsigned int address) { uint8t i; uint32t jumpaddress = *(_IO uint32t)(address + 4); pfunction pjumpfunction = (pfunction)jumpaddress; __disableirq(); // stop all interrupts // 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_irq();
__set_CONTROL(0);
// re-init stack pointer (first entry of the vector table)
__set_MSP(*(__IO uint32_t*)address);

pjumpfunction(); } ~~~

my application start correctly RTOS create theall the tasks and jump to the firsttask. My code is ~~~ firsttask(void const * argument) { kernelStatus = osKernelRunning();// status is ok

for( ;; ) {
	// do somethings ...
	OSIDelay(200); //never exit
}

} ~~~

It Seem's as the scheduler dosen't run. Any Idea


Bootloader

Posted by rtel on October 21, 2016

This is a very old thread, and without knowing what happens at the address you are jumping to it is difficult to know.

You need to have a vector table set up for the application you are jumping to, set the vector base address register to that vector table, and make sure the FreeRTOS interrupt handlers (PendSV, SysTick and SVCall) handlers are installed in the vector table. I would then recommend leaving interrupts globally disabled, reading the reset address out of the second position of the vector table used by the application you are jumping to, and jumping to that address to ensure the C run time code is also executed before main().


[ 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