Quality RTOS & Embedded Software

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


Loading

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:

...
MEMORY
{
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:

...
MEMORY
{
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.

Regards.

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

copy:
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. */
msr CPSR_c, #MODE_SVC|I_BIT|F_BIT

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

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

prog 0x00108038 0x20424
*(.text)
.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.

Yuantu

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