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 for MSP430F2416 extend memory

Other Parts Discussed in Thread: MSP430F149, MSP430F2416

hello everybody !

I recently discovered a matter in my MSP430X software, but I also made a migration severals months ago, maybe it's the source of my problem. I searched a long time between several datasheets and migration guides, but I didn't find answer, so I came to you!

I'm working on a MSP430F2416 with IAR 4.21.2 in assembly only, and I have made a migration from a MSP430F149 several months ago. I didn't succed to migrate without change on the linker (lnk430F2416.xcl) with the line of CODE definition :   -P(CODE)CODE=2100-FFBD,10000-18FFF

IAR give me an error while running linker:

"Error[e104]: Failed to fit all segments into specified ranges. Problem discovered in segment CODE. Unable to place 1 block(s) (0xf6de byte(s) total) in 
0x16ebe byte(s) of memory. The problem occurred while processing the segment placement command "-P(CODE)CODE=2100-FFBD,10000-18FFF", 
where at the moment of placement the available memory ranges were "CODE:2100-ffbd,CODE:10000-18fff"
"

So I created a second segment of code named FARCODE to acces the extend memory :

-Z(CODE)CODE=2100-FFBD
-Z(CODE)FARCODE=10000-18FFF

This way, original code of the MSP430F149 was able to be migrated without change, and extend memory is filled with the new code placed in FARCODE segment. But I recently discovered a problem of interaction between extend (FARCODE) and normal (CODE) memory:

When I use a variable in RAM (that have a location in 16 bits) in a instruction located in extend memory with the same location in 20 Bits, the variable in RAM isn't recognized. In fact the assembly code aims to the right adress but in the extend code !

For instance : my variable named Var1 is located in 0x192D, I create an assembley code in extend memory at the adress  0x01192A with :

    movx.b     #1,   Var1

But my assembly code is:


 01192A    184F 43D0 FFFF          movx.b  #0x1,0x1192D
 011930    3C2E                              jmp     End_Test

Var1 is not recognized by the MSP430X, instead of aiming to VAR1 located in RAM (0x00192D), the code aim to the same location but in extend memory (0x11192D).

This can be made with all the location in RAM corresponding to the movx.b instruction: 0x192A ; 0x192B ; 0x192C ; 0x192D ; 0x192E and 0x192F; but the inscruction works well with all other location in RAM memory

Maybe this problem is in relation with the creation of FARCODE?

Please if someone have an idea, let me know.

Thanks a lot

Rudy

 

 

  • I think you should use &Var1 instead of Var1.

  • rudy robin said:
    01192A    184F 43D0 FFFF          movx.b  #0x1,0x1192D
     011930    3C2E                              jmp     End_Test

    OCY is right, in your code, you use symbolic mode and not absolute mode for addressing your variable. Normally, this should give the same result. But in symbolic mode, if the code is moved, the destination address moves too. In this case, the symbolic address points to the lastbyte of the instruction (relative address -1) which indeed is 0x1192d.
    I guess something got wrong when moving your code from lower to upper code segment. Maybe a linker bug (the compiler usually does not use symbolic mode and maybe nobody ever noticed this bug) or you did something wrong when moving your code. Maybe this only happens if the new code address is similar to the variable address. Of if the destination is in a different segment and not moved together.
    Normally, symbolic mode shall be only used if both, source and destination, reside in the same segment. FARCOD and RAM are different segments.

    Using absolute mode (&Var1)  will most likely solve this problem. And is the recommanded addressing mode if code and parameter are located in different segments.

  • thanks both of you two,

     

    I changed my code to absolut mode and it goes ok

     

     

**Attention** This is a public forum