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.

Help with Assembly Language in the BSL_ACTION0 in BSL430_Low_Level_Init.asm

Hello All,

I am trying to understand the assembly language function from the BSL430_Low_Level_Init.asm.  Here is the listing

BSL_ACTION0
              CMP      #0xDEAD, ARG2
              JNE      RETURN_ERROR
              CMP      #0xBEEF, ARG3
              JNE      RETURN_ERROR
              ;CMP      #0x01, ARG1
              ; to do ... comment!
              ;JEQ      BSL_Unprotect          ; 1 == unlock BSL flash area
              ;JEQ      JTAG_Lock
              ;JL       BSL_SW_ID              ; 0 == return SW ID
              ;JL       RETURN_ERROR           ; 0 == return SW ID
              JMP      RETURN_TO_BSL           ; 2 == return to BSL
RETURN_ERROR
              CLR      RET_low
              CLR      RET_high
              RETA

So it looks like the function compares 0xDEAD to R13 and 0xBEEF to R14, otherwise it return an error.  So why is it expecting the 0xDEAD and 0xBEEF in there, who put it there.  Is it part of the uC core?

  • Hi Silver Diamond,

    BSL_ACTIONx functions are meant to let you get to BSL functions from an external application (for example if you want to return to/restart BSL after you have loaded a program and started it with SetPC). My understanding is that you need to load these arbitrarily defined values 0xDEAD and 0xBEEF in R13 and R14 before jumping to the address of BSL_ACTION0. The code checks these registers to make sure this BSL_ACTIONx function was called intentionally (rather than being an accidental jump to this address). You can find some more info in section 3.8 of

    Regards,

    Katie

  • dead beef is from the 70's, when to visual see something using only 4 hex digits as choice of words

    Memory location 0x1002 contains a jump to the "BSL Action" function.
    To invoke the action function, three parameters are needed.
    The first parameter is a number describing which function, the second two are
    simply known values to indicate that the function was called intentionally.
    R12: The function number
    R13: 0xDEAD
    R14: 0xBEEF

  • Tony Philipsson said:
    dead beef is from the 70's, when to visual see something using only 4 hex digits as choice of words

     Hi Tony, but from old fashion of hex word I think DEAD C0DE and all magic number of the past. Nostalgic note...

**Attention** This is a public forum