Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Hard Code ASM Instruction in C

jciajcia Member Posts: 1
Hi All,

I am trying to put a series a branch instructions in a certain part of the flash memory, I already made the needed changes to put values on that part of memory, the problem is, I need to put a branch instruction to another address but right now the way I do it is declare a constant long int value with and assign the HEX value of the ASM, let say I want to put asm("mov.w &0xF3DA, PC") so give the value 0xF3DA4210 which translates into BR &0xF3DA, but it seems weird that I have to hard code the value instead of writing the inline asm. The problem is, I need that branch instruction to be there before the program runs and I don't know how to put define the ASM instruction to reside on that location. The way I do it with the constant is like this:

#pragma DATA_SECTION(_B_INT45,".B_INT_45")
const unsigned long int _B_INT45 = 0xF3DA4210;

.B_INT_45 is a section in the linker file which is the part of memory to which I want to save the constant value. What I thought I could do was something like this:

#pragma CODE_SECTION(,".B_INT_45")
asm(" mov.w &0xF3DA,PC");

But that pragma is to define function, not a single instruction. I hope I made myself more or less clear on what I need. Is hardcoding the value my only chance?, I also thought of just creating an assemble file with ORG and the branch instruction, but my Compiler/Linker (TI CCS) doesn't allow that, just inline assembly.

Any help would be appreciated.
Sign In or Register to comment.