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.

Home made Bootloader



Hi,

I need to write my own bootloader for 5509A as I need to boot from SD card. I've got an I2C EEPROM on which I can load that home-made bootloader. This would read the "MyApp.b00" file that has been stored onto the SD card and start executing the code.
I've written all the code that reads the SD and writes it where it has to be (spra375F is clear enough to understand where to put data). Now I miss the last part: jump to "entry point".

How do I do that? Is it simply to move an absolute value in PC?

I've read that I can't write in PC so should I do:
asm(" MOV dbl(EntryPt), RETA");
asm(" RET");

This would write the 32-bit unsigned int "EntryPt" into register RETA that would then go into PC when executing the RETurn instruction.

Do I need to clear or set some other registers like stack pointer...?

Thanks in advance.

Romain

  • Hi,

     

    Here are some code from C5509A boot loader.

     

    ;*******************************************************************************

    ;    Reserved location definitions for use by the bootloader       

    ;*******************************************************************************

     

    ENTRY_POINT .set  0060h   ; 0060h = MSW of the entry point address

            ; 0061h = LSW of the entry point address

     

    BOOT_START:

    mov #0,ac1

    mov ac1, dbl(ENTRY_POINT)    ;clear the entry point

    ...

     

    ;*******************************************************************************

    ; Boot from Asynchronous Memory

    ;*******************************************************************************

    EMIF_BOOT:

    amov #0, xar5 ;clear XAR5

    amov #(CE1_START), xar6 ;set pointer to external CE1 space

    mov xar6, ac0    ;store the boot table pointer in AC0

    mov dbl(*AR6), AC1    ;read the entry point address 

    mov ac1, dbl(ENTRY_POINT) ;and store it

    ...

    END_MEMORY_SECTION_LOOP:

     

    mov dbl(ENTRY_POINT), ac3        ;put the entry point address in AC3

    b End_Boot

     

    ;*******************************************************************************

    ; End of bootload - restores CPU status regster bits to their reset state

    ;       and branches to the entry point to begin execution

    ;*******************************************************************************

    End_Boot:

     

    bset SXMD ;turn on sign extension in accumulators

    IO4_high ;drive IO4 high

    b    ac3 ;branch to the entry point

     

     

    I hope this helps you.

     

    Regards,

    Hyun

     

     

  • Thanks a lot Hyun, it is exactly what I was looking for.

    Romain

     

  • You're welcome. Thanks for clicking verified answer button.

    Hyun

  • Hi Hyun,

    Now I am trying to simulate the SPI EEPROM sequence (24-bits) by one CPU (acts as SPI slave and send data to C5509A after receiving the READ command and address) to download the DSP image. I can download one simple test DSP image which is very small successfully, but I failed to download our formal image which will be bigger and the phenomenon is that the IO4 never sets high after the boot table finished.

    So do you have any suggestion on it? Or could you share the boot loader code which is related to SPI EEPROM boot with me?

    Thank you very much!

  • Hi William,

    I recommend you to open up a new post instead of re-opening the old post which was already answered.

    Usually, verified posts will not get attention when compared to the new posts.

     

    Regards,

    Shankari

  • Hi Shankari,

    Thank you very much for your suggestion. I will open up a new post for this issue.

    Best regards!