After devision, cpu can't run normal code

Mar 18, 2009 3 Replies

I am using YAGARTO Tool to compile code for AT91SAM7X512 CPU. In which it provides ECLIPSE as editor and GCC Version 4.2.1 as compiler. When i compile my project it code space around 256776 Bytes and used ram around



32480 Bytes. It works ok. Now as i add other .C & .H files, my code stop working. I m not calling any function of last added files. Just i only put those files and compile and link. But i m not using any fucntion out of those file. After adding these .C & .H files my code size becomes around
353212 Bytes and used ram size around 66108 Bytes. When i debug code i found that whenever it find devision operation it goes somewhere else and not executing remaining program. So, i m not able understand why this happen. I add only .C & .H files, which are not used any where in my Project. I need those files, but currently i just added those files. My code compile ok but not able to run after devision operation.

Add -ffunction-sections -fdata-sections to your compiler flags and --gc-sections to the linker options. This should remove any unused code from the binary.

Regards, Richard.

  • formatting link
    Designed for Microcontrollers. More than 7000 downloads per month.

  • formatting link
    Certified by TÜV as meeting the requirements for safety related systems.

Are you sure you are not using an AT91SAM7X256 (or have linking set up for that device)? The devices are pretty much identical except for the memory sizes, and your code has trouble once you've passed the limits for the 256k device.

...

I notice you are mentioning .C and .H files. These (uppercase) file extensions indicate to the compiler that it is dealing with C++ code. Rename the files properly to lower case if they are C code.

[mail]: Chuck F (cbfalconer at maineline dot net) [page]: Try the download section.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required