AnsweredAssumed Answered

Code generation with powerpc-eabivle-gcc.exe

Question asked by devver on Apr 30, 2019
Latest reply on Apr 30, 2019 by Martin Kovar



I'm having an issue with the code generated by powerpc-eabivle-gcc.exe. 


When I compile this code




#define FLASH_SECTOR_ADDRESS 0x00000004
#define FLASH_SECTOR_ADDRESS 0x00000000

unsigned int MyFunc(void);

typedef struct {
unsigned char * Buffer;
} tProgFlash;

tProgFlash ProgFlash;

unsigned int MyFunc(void)
unsigned int CmdResult = 0;
if( *((unsigned int *) FLASH_SECTOR_ADDRESS) == 0xFFFFFFFF ) {
ProgFlash.Buffer = 0;
return CmdResult;



The output of powerpc-eabivle-objdump.exe is this:


Disassembly of section .text.MyFunc:

00000000 <MyFunc>:
0: 48 07 se_li r7,0
2: c0 77 se_lwz r7,0(r7)
4: 7f e0 00 08 trap


The full command prompt I use to compile:


"C:/SysGCC/powerpc-eabi/bin/powerpc-eabivle-gcc.exe" -c -O2 -g3 -Wall -c -fmessage-length=0 -ffunction-sections -fdata-sections -mcpu=e200z3 -mbig -mvle -mregnames -mhard-float -meabi -Werror -specs="C:/SysGCC/powerpc-eabi/powerpc-eabivle/lib/e200z3/nosys.specs" -I"C:/SysGCC/powerpc-eabi/powerpc-eabivle/include" --sysroot="C:/SysGCC/powerpc-eabi/powerpc-eabivle/lib/e200z3/" -MMD -MP -MF"Test.d" -MT"Test.o" -c -o "Test.o" "Test.c"


The version I'm using:


powerpc-eabivle-gcc.exe (BLD = 1607) 4.9.4 20160726 ( rev=gceb1328 s=F494 -i /opt/freescale ELe200 -V release_gceb1328_build_Fed_ELe200_ML3)


With optimisation level O1 the trap instruction is not generated. When using the define "

COMPILE_WITHOUT_TRAP_INSTRUCTION" the code compiles perfectly, even with O2.


Can you please help out?


Thanks in advance.