EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

After devision, cpu can't run normal code

Started by bhavin March 18, 2009
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.


"bhavin" <bhavintailor_ec@yahoo.com> wrote in message 
news:xKOdnfOYe_0GfF3UnZ2dnUVZ_rjinZ2d@giganews.com...
>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. + http://www.FreeRTOS.org Designed for Microcontrollers. More than 7000 downloads per month. + http://www.SafeRTOS.com Certified by T&#4294967295;V as meeting the requirements for safety related systems.
bhavin wrote:
> 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. > >
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.
bhavin wrote:
> > 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
... 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]: <http://cbfalconer.home.att.net> Try the download section.

The 2024 Embedded Online Conference