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.

TMS320F280025C: Bootloader for CAN (with encryption)

Part Number: TMS320F280025C
Other Parts Discussed in Thread: LAUNCHXL-F280025C, C2000WARE

Hi,

I'm using a TMS320F280025C on the evaluation board LAUNCHXL-F280025C and everything so far works fine.

Now I need a bootloader, where I can make some firmware updates in the field over CAN. At the moment I already hang

to find a bootloader example (not encrypted and over UART/SCI) for the F280025C, since there is no example at all  (not even blinky LED) in the 

C2000Ware_4_00_00_00 SDK folder for the F280025C. 

Do you provide a bootloader example over a serial interface somewhere? Can I trigger the bootloader from the application instead of using a GPIO pin?

Can I catch the data and manually give it to the bootloader, so that I can do decription beforehand?

I have done this many time on STM32 controllers and there the support for something like that is amazing. Hope you can provide something similar.

  • you can call bootloader APIs from application. but i will finish complete transfer to RAM and then return. so you cant do the decryption in parallel.

    there are examples in C2000ware to use bootloader using SCI - C:\ti\c2000\C2000Ware_4_01_00_00_new\driverlib\f28002x\examples\flash 

    The section "4.8 Application Notes for Using the Bootloaders" in TRM may be helpful.

  • Thank you, that was very informative. So, with the application flash API I can receive encrypted packets over my communication interface of choice and flash the decoded package always as a whole sector from RAM. 

    What I'm unsure at the moment is, how I can jump to the application flash address from the bootloader itself. Especially what do I need to change in the linker file?

  • What I found out it, that in the example flash_kernel_ex3_sci_flash_kernel there is the following code in flash_kernel_ex3_codestartbranch:

    ;-----------------------------------------------
    ; ExitBoot
    ;-----------------------------------------------
    ;-----------------------------------------------
    ;This module cleans up after the boot loader
    ;
    ; 1) Make sure the stack is deallocated.
    ;    SP = 0x400 after exiting the boot
    ;    loader
    ; 2) Push 0 onto the stack so RPC will be
    ;    0 after using LRETR to jump to the
    ;    entry point
    ; 2) Load RPC with the entry point
    ; 3) Clear all XARn registers
    ; 4) Clear ACC, P and XT registers
    ; 5) LRETR - this will also clear the RPC
    ;    register since 0 was on the stack
    ;-----------------------------------------------
    
    ExitBoot:
    
    __stack:    .usect ".stack",0
    
    ;-----------------------------------------------
    ;   Insure that the stack is deallocated
    ;-----------------------------------------------
    
        MOV SP,#__stack
    
    ;-----------------------------------------------
    ; Clear the bottom of the stack.  This will endup
    ; in RPC when we are finished
    ;-----------------------------------------------
    
        MOV  *SP++,#0
        MOV  *SP++,#0
    
    ;-----------------------------------------------
    ; Load RPC with the entry point as determined
    ; by the boot mode.  This address will be returned
    ; in the ACC register.
    ;-----------------------------------------------
    
        PUSH ACC
        POP  RPC
    
    ;-----------------------------------------------
    ; Put registers back in their reset state.
    ;
    ; Clear all the XARn, ACC, XT, and P and DP
    ; registers
    ;
    ; NOTE: Leave the device in C28x operating mode
    ;       (OBJMODE = 1, AMODE = 0)
    ;-----------------------------------------------
        ZAPA
        MOVL  XT,ACC
        MOVZ  AR0,AL
        MOVZ  AR1,AL
        MOVZ  AR2,AL
        MOVZ  AR3,AL
        MOVZ  AR4,AL
        MOVZ  AR5,AL
        MOVZ  AR6,AL
        MOVZ  AR7,AL
        MOVW  DP, #0
    
    ;------------------------------------------------
    ;   Restore ST0 and ST1.  Note OBJMODE is
    ;   the only bit not restored to its reset state.
    ;   OBJMODE is left set for C28x object operating
    ;   mode.
    ;
    ;  ST0 = 0x0000     ST1 = 0x0A0B
    ;  15:10 OVC = 0    15:13      ARP = 0
    ;   9: 7  PM = 0       12       XF = 0
    ;      6   V = 0       11  M0M1MAP = 1
    ;      5   N = 0       10  reserved
    ;      4   Z = 0        9  OBJMODE = 1
    ;      3   C = 0        8    AMODE = 0
    ;      2  TC = 0        7 IDLESTAT = 0
    ;      1 OVM = 0        6   EALLOW = 0
    ;      0 SXM = 0        5     LOOP = 0
    ;                       4      SPA = 0
    ;                       3     VMAP = 1
    ;                       2    PAGE0 = 0
    ;                       1     DBGM = 1
    ;                       0     INTM = 1
    ;-----------------------------------------------
    
        MOV  *SP++,#0
        MOV  *SP++,#0x0A0B
        POP  ST1
        POP  ST0
    
    ;------------------------------------------------
    ;   Jump to the EntryAddr as defined by the
    ;   boot mode selected and continue execution
    ;-----------------------------------------------
    
        LRETR
    
    ;eof ----------
    
    	.end
    

    When I flash my app at flash sector 5 and start this app, it will run the code when the main returns the jump address, but then after I reset the controller, the bootloader never starts again and it jumps immediately to the app. Can I somehow always run the bootloader at startup? What do I need to modify in the .asm file to achieve this?

    Edit: I think I was wrong, the bootloader seems never to jump to the address, it somehow boots always the app at the flash address of sector 5 begin

  • you need no use the asm file for jump. You can use simple instruction like below example and jump to beginning address of app.

    asm("    LB 0x8EFF0");