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


Bootloader + FreeRTOS + SAM7X

Posted by Francois-Pascal Bello on March 18, 2009
I am trying to use FreeRTOS with a bootloader residing in my AT91SAM7X256 flash. I can succesfully reprogram the flash section of my processor with FreeRTOS code. Then, my booloader jumps into RTOS code and goes through inits. I can create tasks, but the program seems to stop when it is time to load the first task. Does anyone have an idea? Is there an initilisation I must do before jumping in RTOS code without resetting my processor?

RE: Bootloader + FreeRTOS + SAM7X

Posted by sotd on March 18, 2009
is the processor in supervisor mode.

RE: Bootloader + FreeRTOS + SAM7X

Posted by Francois-Pascal Bello on March 19, 2009
I have found out the processor was not reinitiliazed correctly before starting FreeRTOS.
I have used the reset peripherals command before jumping to RTOS code and it seems to run now!
The only problem that remains is with USB: my bootloader only uses serial port. Since I am using the AT91SAM7X dev board, the processor is USB powered. When I connect the USB cable, the device is not answering, thus not recognized by my PC. Is there a way to resend the information to the PC when FreeRTOS starts or do I have to initialize USB connection in my bootloader?

RE: Bootloader + FreeRTOS + SAM7X

Posted by Dave on March 19, 2009
It depends on the wiring of your hardware. Some hardware allows you to toggle the USB pull up resistor to indicate to the host that the USB has been disconnected then reconnected again. The Atmel SAM7S dev kit lets you do this, the SAM7X dev kit doesn't because the resistor is just hard wired.

RE: Bootloader + FreeRTOS + SAM7X

Posted by Francois-Pascal Bello on March 19, 2009
I have modified the demo board hardware, and have modifies RTOS code so that I can toggle the pull-up and it works!
Thanks for the advice.

RE: Bootloader + FreeRTOS + SAM7X

Posted by Yuantu Huang on March 28, 2012
I am writing a SD bootloader for SAM7X512. The bootloader resides in flash from 0x0000 to 0x8000 and the FreeRTOS application start from 0x8000. The FreeRTOS app linker script is modified as follows:

flash: ORIGIN = 0x00108000, LENGTH = 480K
ram: ORIGIN = 0x00200000, LENGTH = 128K
. = 0x8000;
startup : { *(.startup)} >flash

The bootloader jumps 0x8000 as follows:

asm("mov r3, #1\n");
asm("lsl r3, r3, #15\n");
asm("bx r3\n");

After jumping the app did not start. I think I am missing something. I am very much appreciated if somebody can give helps.

RE: Bootloader + FreeRTOS + SAM7X

Posted by Yuantu Huang on March 28, 2012
Actually after bootloader jumping to 0x8000, the application starts and all tasks were created, but all interrupt seemed gone so that vPreemptiveTick was not triggered any more. Do I need remap the interrupt vectors or something else? Currently I just simple modified the linker script. Both bootloader and application ld files are same as that of FreeRTOS AT91SAM7x demo provided except changing one line for booltloader below and two lines for app given in the previous message:

flash : ORIGIN = 0x00100000, LENGTH = 32K
ram : ORIGIN = 0x00200000, LENGTH = 128K

I would be grateful if someone could give some hints how to fix the problem.

RE: Bootloader + FreeRTOS + SAM7X

Posted by Richard on March 28, 2012
You will almost definitely have to remap the vector table if you are using a bootloader.


RE: Bootloader + FreeRTOS + SAM7X

Posted by Yuantu Huang on March 29, 2012
Hi Richard,

Thank you very mich for your suggestions. Previously I was using PIC and Renesas chip. SAM7 chip is reletive new for me and I do not know how to remap the exception vectors (I tried to remap them in boot.s to staring from 0x00, but the app could not start).

Could you please give me a codesnip to remap vector table you mentioned? For PIC, remapping all vectors can be done in the linker script. For SMA7, is remapping vectors done in boot.s? Thank you again for your help.

RE: Bootloader + FreeRTOS + SAM7X

Posted by Yuantu Huang on March 30, 2012
Hi Richard,

I did not describe clearly in the last email. I added the following piece of code in the boot.s:

/*===================== Vector table remap ===========================*/
.global .reset_start
.global .vectors_end

.equ __excVecStart, 0x108000 /* .reset_start = 0x108000 */
.equ __excVecEnd, 0x108038 /* .vectors_end = 0x108038 */
.equ __ramStart, 0x200000

.equ __AT91C_BASE_MC, 0xFFFFFF00
.equ __AT91C_MC_RCB, 0x01
.equ __MC_RCR, 0x00

ldr r0, =__excVecStart
ldr r1, =__ramStart
ldr r2, =__excVecEnd

ldr r3, [r0], #4
str r3, [r1], #4
cmp r0, r2
bne copy

/* Remap exception vectors at address 0*/
ldr r0, =__AT91C_BASE_MC
ldr r1, =__AT91C_MC_RCB
str r1, [r0, #__MC_RCR]


I insert the above code between
msr CPSR_c, #MODE_SYS|I_BIT|F_BIT /* System Mode */
mov sp, r0

/* We want to start in supervisor mode. Operation will switch to system
mode when the first task starts. */

The vector addresses are copy from map file see below:
0x00008000 . = 0x8000

startup 0x00108000 0x38
.startup 0x00108000 0x38 C:\Users\yhuang\AppData\Local\Temp\ccClEVET.o
0x00108000 .reset_start
0x00108038 .vectors_end

prog 0x00108038 0x20424
.text 0x00108038 0x100 obj/main.o

It seems to me the vector table has been copy to address 0, but the application does not start. It stops in the first vPortISRStartFirstTask. I guess no time tick interrupt. Any suggestion? Thank you.


Bootloader + FreeRTOS + SAM7X

Posted by vladbfg on February 18, 2014

Hi Yuantu Huang! How you solved your problem?

Bootloader + FreeRTOS + SAM7X

Posted by vladbfg on February 18, 2014

Hi Yuantu Huang! How you solved your problem?

[ 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