This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Custom bootloader question and changing link location of .resetVecs

Other Parts Discussed in Thread: SYSBIOS

Hello,

First off, the tools I'm using:

SYS/BIOS 6.32.2.39

XDCtools 3.22.1.21

CCS 4.2.4.00033

Using a Stellaris LM3S9D92 part on a custom board

 

I've been working on a custom "boot" application that will always run on board power-up. The basic idea is as follows:

After power-up it will check some address in flash among other things (checksum of code, etc.) and make a decision on whether or not it should run the "main" application. If the main code does not run then the "boot" code will continue execution and should allow main code to be programmed over ethernet. The "main" application will be a different bin file linked to a seperate section of flash than the bootloader). Both the "boot" and "main" applications will use SYS/BIOS. Side note, I would like to program this logic in c. I have two questions about this:

1. In order to "jump" to the main application from boot should I just call a function (using a function pointer) to the location of the main code's reset handler? Or is there some other clean-up that needs to be done first? For example: (*((void (*)(void))(*(unsigned long *)0x00020004)))();

2. I noticed that the generated linker cmd file for SYS/BIOS apps is always placing the ".resetVecs" section to location 0x0 in flash. Is it possible to override this and set it to some other known address so that both my boot and main code vector tables can coexist in flash?

Thanks,

Mike

  • Anyone have any input on this? Maybe there is a better way to implement the same functionality I'm looking for?

  • Mike,

    1)  The xdc.runtime.Reset module allows you to add a reset function that runs before c_int00.

    Here's a configuration file snippet that shows how to add a Reset function called "myResetFunction":

        var Reset = xdc.useModule('xdc.runtime.Reset');
        Reset.fxns[Reset.fxns.length++]  = '&myResetFunction';

    2) You can place the .resetVecs section at another address by adding code like the following to you configuration file:

        var Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi");

        Hwi.resetVectorAddress = 0x012345678;  /* replace with the address you want to use */

    I hope this helps.

    Alan

     

     

  • Thanks Alan, that's exactly what I was looking for.

  • Hi, Mike.

    I would like to do exactly the same thing, but I don't get too far at this moment. 

    Could you tell me.

    1. How to make the 'boot' and 'main' into different address/section in code and data?

    2. How do I know the size of 'boot' and 'main' ? In CCS, *.out file is big, I guess there are a lot of symbol, none binary information. 

    Thanks,

    Sink