FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
5922 Discussions

Problem with compilation option G2, used together with optimization level 02

Honored Contributor II

Hello to all,  

I had a pointer out of range linkage error with altera 7.2. The gcc version is 3.235. It seemed I had to use "far" pointers compilation. So I have solved the issue using the compilation option G2. Now I have faced another problem. When I compile the software using G2 and some optimization level. For instance O1, O2 or other, the application links successful, but crashes at runtime. It works fine with no optimizations ( O0 ), but I need to launch it with optimization level O2. So here are my options for Debug and Release: 


For Debug: 



-c -D__hal__ -pipe $(LIB_SYMBOLS) -mno-hw-mulx $(CC_HW_FLAGS) -g -O0 -Wall  



For Release: 


-c -D__hal__ -pipe $(LIB_SYMBOLS) -mno-hw-mulx $(CC_HW_FLAGS) -O2 -Wall  



So the only difference between debug and release flags is in the option: -O0 for Debug and O2 for release. In Release my application crashes and this is because of the combination of G2 + O2. It also crashes with the combinations: G1 or G0 + O2. same with O1 or O3. Does anybody have faced such an issue and is there a way I can fix it ?  

Thanks in advance.
0 Kudos
0 Replies