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.

How to specify entry point of a DSP/BIOS based application when using a secondary bootloader

Hi,

I am working on a board based on a 64x+ dsp. I have a NAND flash connected to this DSP. I perform I2C master boot, in the I2C EEPROM is my NAND secondary bootloader.

Using this boot loader I was able to run a simple LED blink application from NAND on boot-up. The nand bootloader simply copies the binary image of the application from NAND to DDR2 and calls the main() function using a function pointer. The offset of main from loading address needs to be specified when writing to the NAND.

 

Now I want to run a somewhat complex application which is build using DSP/BIOS. My question is how to specify the execution start address.

If I specify the address of _cint_00_, then it does not execute. Same is the case with the LED blinking application, where in I need to specify the address of the main() function as starting point.

 

But in this complex application, there is a task and other BIOS related stuff, I am not able to execute it using  address of main() function.....

 

As a cross check I have compared the application loaded directly using CCS/JTAG and using my nand boot application from NAND flash, The memory is loaded with same data in both cases. The only thing matters is the execution start address...

 

Can any one help me on this?

 

Help is highly appreciated...

 

Thanks,

Amitkumar

(amitkumar.solanki@einfochips.com)

  • Thanks Mariana for your reply.

    The post suggests that c_int00 address will suffice to start the execution. But in my case, when I point a function pointer to c_int00 and then call it, the main() routine is not called subsequently and the PC then goes in to memory with all NOPs. I have tried this with a very simple application which blinks LEDs....

    Can you please suggest some thing?

    Thanks,

    Amit

    (amitkumar.solanki@einfochips.com)

  • Amitkumar Solanki said:

    I am working on a board based on a 64x+ dsp.

    Which C64x+ DSP? It could be important.

    Amitkumar Solanki said:

    Using this boot loader I was able to run a simple LED blink application from NAND on boot-up. The nand bootloader simply copies the binary image of the application from NAND to DDR2 and calls the main() function using a function pointer. The offset of main from loading address needs to be specified when writing to the NAND.

    Now I want to run a somewhat complex application which is build using DSP/BIOS. My question is how to specify the execution start address.

    If I specify the address of _cint_00_, then it does not execute. Same is the case with the LED blinking application, where in I need to specify the address of the main() function as starting point.

    If your LED blink application is a C program, it should be started by going to c_int00 and not main(). The fact that it works probably means that there is no C environment needed, like a stack pointer or such, although any local variables would be placed at whatever location the SP happens to be pointing. So maybe you are using only global variables? It may be easiest to figure out the big app's problem by figuring out what using c_int00 as the entry point for the LED blink app did not work.

    For example, if you load the LED blink app using CCS/JTAG and do not start it running, where is the Program Counter immediately after loading? It should be at the specified entry point, and that should be c_int00. If it is at main() then you might have an option checked to automatically GoMain, which for this debugging should be turned off (Option->Customize / Debug Properties / uncheck "Perform Go Main automatically"). Even after loading, you should be able to use the Debug->Restart to get back to the entry point.

    If what you see does not fit the descriptions from Mariana's posting and my description here, upload your .map file to your reply to this posting (in the reply window, Options tab, File Attachment click Add/Update).

    Amitkumar Solanki said:

    The post suggests that c_int00 address will suffice to start the execution. But in my case, when I point a function pointer to c_int00 and then call it, the main() routine is not called subsequently and the PC then goes in to memory with all NOPs. I have tried this with a very simple application which blinks LEDs....

    When you "point a function point to c_int00 and then call it", what does happen? Do you start executing at c_int00 and can you single-step from there in CCS?

  • Thanks Randy for your reply,

    RandyP said:

    Which C64x+ DSP? It could be important.

    I am working on a TCI6486 DSP.

    RandyP said:

    If your LED blink application is a C program, it should be started by going to c_int00 and not main(). The fact that it works probably means that there is no C environment needed, like a stack pointer or such, although any local variables would be placed at whatever location the SP happens to be pointing. So maybe you are using only global variables? It may be easiest to figure out the big app's problem by figuring out what using c_int00 as the entry point for the LED blink app did not work.

    Yes. My application does not use any variables.

    RandyP said:

    For example, if you load the LED blink app using CCS/JTAG and do not start it running, where is the Program Counter immediately after loading? It should be at the specified entry point, and that should be c_int00. If it is at main() then you might have an option checked to automatically GoMain, which for this debugging should be turned off (Option->Customize / Debug Properties / uncheck "Perform Go Main automatically"). Even after loading, you should be able to use the Debug->Restart to get back to the entry point.

    If what you see does not fit the descriptions from Mariana's posting and my description here, upload your .map file to your reply to this posting (in the reply window, Options tab, File Attachment click Add/Update).

    Please find attached a rar file with the source file, linker file, map file, out file, rmd file use to generate the bin file and bin file.

    RandyP said:

    When you "point a function point to c_int00 and then call it", what does happen? Do you start executing at c_int00 and can you single-step from there in CCS?

    I am able to single step from c_int00 there in CCS, but then it jump to some unknown location.

    Thanks,

    Amit

    (amitkumar.solanki@einfochips.com)

    source.rar
  • Thanks Randy and Mariana,

    I was able to run the application by pointing to c_int00.

    I was actually linking the file for one memory range and loading it to other memory range.

    When I loaded the bin file to the memory range for which it was linked, I was able to successfully execute the application.

    Does this mean that the bin files generated by hex6x are not relocatable?

    Thanks for your valuable suggestion....

    Amit

    (amitkmar.solanki@einfochips.com)

  • Adding to my question: Does this mean that the bin files generated by hex6x are not relocatable?

    The binary image file is generated with following options in the .rmd file for hex6x utility:

    simple.out
    -b
    -e _c_int00
    -order M 
    -image

     

    Thanks,

    Amit

    (amitkumar.solanki@einfochips.com)

  • Once a C6000 program is linked to form an executable file, it is not relocatable. There are portions of the code that will use relative addressing and may appear to be relocatable, but some portions will use fixed addressing and must be placed at the location that the linker chose. There is not a way to differentiate between these parts of the program, so the whole thing must be considered non-relocatable.

    To help in the bootloading process, the linker has the capability to distinguish between the LOAD address where the program will be stored prior to bootloading and the RUN address where the program will be located after bootloading to actually execute. This is described in the C6000 Assembly Language Tools User's Guide spru186 (q) section 7.9.