Branch Instruction for S32DS Power

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Branch Instruction for S32DS Power

Jump to solution
2,101 Views
bjrajendra
Senior Contributor I

Hello all,

I'm migrating my MPC5602P device software from CCW to S32DS.

As I developed a bootloader for that which involves few assembly instructions.

I'm using some assembly instructions like

asm("xor    r3,r11,r9"); 

unsupported relocation against r3, r11 & r9

 

which I replace d with asm("xor %r3,%r11,%r9"); and it started working.

Now I used branch Instruction using asm("bne  btd") where (in case if non zero flag exists) it should branch to 

asm("btd:") ;

{

   XXXX;

}

But it's not happening. Instead,. it goes to some other location.

Kindly help in this regard

Thanks in advance,

Raju

0 Kudos
Reply
1 Solution
1,772 Views
peter_vranken
Contributor IV

Hello!

1) You may have a problem with the selection of the instruction set to use. Your disassembly shows VLE, your asm statements use Book E. Several Book E instructions my be used in a VLE environment but far not all of them. Check your code against

* Variable-Length Encoding (VLE) Programming Environments Manual: A Supplement to the EREF

* EREF 2.0: A Programmer’s Reference Manual for Freescale Power Architecture® Processors

The choice of the instruction set is usually made in the boot sector and by MMU configuration. (I've not double-checked the details for your particular MCU.)

2) Add the switches -save-temps=obj -fverbose-asm to the compilation command line. You will get a *.lst and a *.s file aside to the *.o file, you should already get. In particular the *.s will show you in any detail in which way your asm code is intermingled with the compiler emitted code. Mostly, this is most meaningful in situations like you encounter

Kind regards

Peter

View solution in original post

0 Kudos
Reply
4 Replies
1,772 Views
bjrajendra
Senior Contributor I

In fact, I'm using asm("bne  btd") to branch (in case if non zero flag exists) to 

asm("btd:") ;

{

   XXXX;

}

looks like there is something wrong in assembly code which actually seen in Disassembly Section. Below is the screenshot for the same

pastedImage_3.png

Also, it resets once the asm(""bne- btd") instruction executes.

Kindly help in this regard.

0 Kudos
Reply
1,773 Views
peter_vranken
Contributor IV

Hello!

1) You may have a problem with the selection of the instruction set to use. Your disassembly shows VLE, your asm statements use Book E. Several Book E instructions my be used in a VLE environment but far not all of them. Check your code against

* Variable-Length Encoding (VLE) Programming Environments Manual: A Supplement to the EREF

* EREF 2.0: A Programmer’s Reference Manual for Freescale Power Architecture® Processors

The choice of the instruction set is usually made in the boot sector and by MMU configuration. (I've not double-checked the details for your particular MCU.)

2) Add the switches -save-temps=obj -fverbose-asm to the compilation command line. You will get a *.lst and a *.s file aside to the *.o file, you should already get. In particular the *.s will show you in any detail in which way your asm code is intermingled with the compiler emitted code. Mostly, this is most meaningful in situations like you encounter

Kind regards

Peter

0 Kudos
Reply
1,772 Views
bjrajendra
Senior Contributor I

Hi Peter,

Thanks for your reply & support.

As you mentioned, I went through those documents and solved it.

Also, kindly mention where exactly I need to add -save-temps=obj -fverbose-asm  in the project so as to generate *.lst and *.s files

Thanks once again,

Raju

0 Kudos
Reply
1,772 Views
peter_vranken
Contributor IV

Hi Raju,

If you build your SW under control of a self-written makefile then you would add the red text literally to the command line of the compiler.

If you use the project wizard of S32DS to create a project and then you compile it in the IDE (e.g. hammer icon), then you would open the properties of the project and click to C/C++ Build/Settings, tab Tool Settings, Standard S32DS C Compiler/Miscellaneous. On the right hand side you can check "Save temporary files" and more. I presume that "Save temporary files" will relate to -save-temps=obj and "Verbose" may relate to -fverbose-asm (although this is less likely). Checking "Generate assembler listing" will also be a good idea:

2020-01-02 15_26_12-Start.jpg

Alternatively, you can place any compiler command line switches at C/C++ Build/Settings, tab Tool Settings, Standard S32DS C Compiler/Optimization/Other optimization flags:

2020-01-02 15_27_31-Search.jpg

Note, all of these configuration settings relate to the basic compilation configuration (mostly Debug or Release), which is selected in drop-down box "Configuration" at the top of the property page.

After any change of these settings, recompile and carefully look at the console output of the build to see whether your configuration changes are reflected by according changes of the echoed compiler command lines.

Regards,

Peter