Quality RTOS & Embedded Software

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




Loading

jump from bootloader to FreeRTOS app using PIC32

Posted by servegajim on June 29, 2016

Hello all, I'm new with PICs.

I was working with bootloader (CAN bus and ethernet) with PIC32 (ethernet starter kit of microchip), perform some projects and every was good. Now I have to develop a RTOS app capable to be mounted using a bootloader but here is the problem.

I create a simple app using FreeRTOS, work with interrupts from CAN bus and some I/O, if I load this thru programer to PIC, works good.

I change the app for bootloader (add a linker file, remove pragmas, etc), the hex file generated is good written for bootloader in PIC, when I send a command to jump to app, the aplication is not working.

I was do the same steps in previous development and work good, but without FreeRTOS.

I was spend 2 days trying to solve my self but I can not determinate where is the error.

I really appreciate your help.

Thanks!

Sergio.


jump from bootloader to FreeRTOS app using PIC32

Posted by rtel on June 30, 2016

When you jump to the program from the bootloader, what happens? Does the program start, but no tasks run, or does it just jump into a random address, etc.?

If the program does start executing, but not correctly, then are you changing the interrupt vector table so the FreeRTOS interrupts are installed?


jump from bootloader to FreeRTOS app using PIC32

Posted by servegajim on June 30, 2016

Hi, thanks for your answer.

When I jump to app, no task running, nothing happens. For example, if I load thru bootloader an app with this code in main.c works good:

while(1) { for(i=0;i<500000;i++); vParTestToggleLED( 0 ); TxBuff[0]=0xDD; TxBuff[1]=0xBB; CAN1TxSendMsg(0x01,TxBuff,2); }

when I use FreeRTOS in main.c like this, the app is not work after jump, no signal or leds blink.

*vSemaphoreCreateBinary(xBinarySemaphore); vSemaphoreCreateBinary(xBinarySemaphoreIO);

if( xBinarySemaphore != NULL ) { xTaskCreate( prvQueueReceiveTask, "LEDtoggle", 240, ( void )0x22UL, 1,NULL ); xTaskCreate( CAN1RxMsgProcess, "CANHandler", 240, NULL, 1, NULL ); xTaskCreate( IOProcess, "IOHandler", 240, NULL, 1, NULL );

    / Start the scheduler so the created tasks start executing.  /
    vTaskStartScheduler();
}

// Start FreeRTOS scheduler.
vTaskStartScheduler();

while(1); *

If I load the app with FreeRTOS code, direct thru the programer (removing linker file and adding pragma config), the program works good (no bootloader).

I think that the problem is with memory location, start memory address or RAM distribution, I don't know.

In your second question, I don't know what vector table are your talking, maybe I change or maybe not, I am very new with PICs and RTOS. Please let me know what is this and how works.

I am attaching the linker file for Bootloader Program and Application, is the only section that I set memory address.

If you need more information let me know.

Thanks for your help.

Regards!


jump from bootloader to FreeRTOS app using PIC32

Posted by rtel on June 30, 2016

In your second question, I don't know what vector table are your talking, maybe I change or maybe not, I am very new with PICs and RTOS. Please let me know what is this and how works.

I think this knowledge is a prerequisite to writing a bootloader.


jump from bootloader to FreeRTOS app using PIC32

Posted by tlafleur on June 30, 2016

You might want to start from the compiler preamble setup code that then calls main()

It's responsible for all the variable init and setting the stack ect. See compiler manual or look at Microchip boot loader code for more info.

~~ _/) ~~~~ _/) ~~~~ _/) ~~~~ _/) ~~

On Jun 30, 2016, at 9:46 AM, Sergio Vega servegajim@users.sf.net wrote:

Hi, thanks for your answer.

When I jump to app, no task running, nothing happens. For example, if I load thru bootloader an app with this code in main.c works good:

while(1) { for(i=0;i<500000;i++); vParTestToggleLED( 0 ); TxBuff[0]=0xDD; TxBuff[1]=0xBB; CAN1TxSendMsg(0x01,TxBuff,2); }

when I use FreeRTOS in main.c like this, the app is not work after jump, no signal or leds blink.

*vSemaphoreCreateBinary(xBinarySemaphore); vSemaphoreCreateBinary(xBinarySemaphoreIO);

if( xBinarySemaphore != NULL ) { xTaskCreate( prvQueueReceiveTask, "LEDtoggle", 240, ( void )0x22UL, 1,NULL ); xTaskCreate( CAN1RxMsgProcess, "CANHandler", 240, NULL, 1, NULL ); xTaskCreate( IOProcess, "IOHandler", 240, NULL, 1, NULL );

/ Start the scheduler so the created tasks start executing.  /
vTaskStartScheduler();

}

// Start FreeRTOS scheduler. vTaskStartScheduler(); while(1); *

If I load the app with FreeRTOS code, direct thru the programer (removing linker file and adding pragma config), the program works good (no bootloader).

I think that the problem is with memory location, start memory address or RAM distribution, I don't know.

In your second question, I don't know what vector table are your talking, maybe I change or maybe not, I am very new with PICs and RTOS. Please let me know what is this and how works.

I am attaching the linker file for Bootloader Program and Application, is the only section that I set memory address.

If you need more information let me know.

Thanks for your help.

Regards!

Attachments:

app32MX795F512L - LinkerFile.ld (30.2 kB; application/octet-stream) btl32MX795F512L_generic - LinkerFile.ld (30.0 kB; application/octet-stream) jump from bootloader to FreeRTOS app using PIC32

Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/freertos/discussion/382005/

To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

Attachments

alternate (3699 bytes)

jump from bootloader to FreeRTOS app using PIC32

Posted by servegajim on June 30, 2016

Hi, thanks for all answers.

Thats I say, I'm new with PICs and FreeRTOS, but I was developed a Bootloader in CAN bus and work good, develop some apps to be loaded by CAN bus bootloader and work good, develop some Ethernet Booloader apps and work good. I never require a file called "vector table" or something like that. I configure the PIC memory only with the linker files, set start address, reset, space for app, etc.

I was create a basic sample in FreeRTOS and work good, the issue is when I try to use this sample to create an application to be loaded using a bootloader.

I am using the demo "PIC32MX_MPLAB" to develop the app and work good, this folder does not containt any vector file or similar, no bootloader sample too. In internet the information is limited for applications like this, the only way to continue is using forums to get some help.

I was looking for vector table information applicable for PIC 32 but not results.

I just need to know why an app using FreeRTOS not work with bootloader if I used the same procedure to create the other apps that work with bootloader.

Probably the error is this vector table, so, how it works? where I can find it? how to be configured? etc.

Really thanks for your time.

Regards!

Sergio.


jump from bootloader to FreeRTOS app using PIC32

Posted by servegajim on July 1, 2016

Hi all, my app is working now. Was a problem with the linker file attached in previous post.

Thanks for your time.

Regards!

Sergo.


jump from bootloader to FreeRTOS app using PIC32

Posted by rjc101 on March 3, 2017

I seem to have having the same issue here, a FreeRTOS app on a PIC32MZ is working perfectly on it's own/ However if I add a linker script and move the ebaseaddress (which is in effect the interrupt vector table) to anything other than the default of 9d000000 the app will run into a general fault as soon as anything interrupt related happens.

I have read elsewhere that other FreeRTOS people have also had similair issues.

I can replicate the issue by simply using the default linker file for the processor (PIC32MZ2048EFM144) and changing

PROVIDE(ebaseaddress = 0x9D000000); to PROVIDE(ebaseaddress = 0x9D002000);

and also

kseg0programmem (rx) : ORIGIN = 0x9D000000, LENGTH = 0x200000 to kseg0programmem (rx) : ORIGIN = 0x9D002000, LENGTH = 0x1F6000

I am looking to use a bootloader so need to move the program and vector table up a little to make room, but it seems when I try this the FreeRTOS app will not run. I don't think it's Harmony related, but it could be.

Any pointers very welcome!


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




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

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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