Embedded Freaks..

February 10, 2009

Removing Unused Functions/Dead Codes with GCC/GNU-ld

Filed under: embedded-tips — Tags: — kunilkuda @ 10:25 am

I was suprised to know that GCC failed to remove the dead codes from my program. Here’s an example:

kunil@cerpelai:~/Temp$ vi test.c
#include

void unusedFunction(void) {
  printf(“This is a dead code\n”);
}

int main(void) {
  printf(“Hello world\n”);
  return 0;
}

kunil@cerpelai:~/Temp$ gcc -Os test.c -o test.elf

If you take a look carefully on the ELF binary, you can see that GCC still includes the “unusedFunction()”, although nothing refers to it.

kunil@cerpelai:~/Temp$ objdump -d test.elf

test.elf:     file format elf32-i386
….
080483c4

:
….
080483e9 :
….

So I was wondering if there’s something wrong with GCC (or GNU-ld), or should I add something to remove it.
(more…)

December 16, 2008

Setting Netbeans for Embedded Linux Application Development

Filed under: embedded-linux, embedded-tips — Tags: , — kunilkuda @ 6:57 pm

I’m using Netbeans as my IDE to build embedded linux application. Here’s the small guide to setup your Netbeans for cross compiler IDE.

(more…)

October 6, 2008

AVR Auto Power Mode Selection

Filed under: avr, embedded-tips — Tags: , — kunilkuda @ 7:04 pm

To optimize the AVR’s power consumption, you will need to modify its power mode according to the peripheral that you need at that time.

This is the part of the TinyOS ATMega128 driver that you can use directly (without TinyOS). It will select the best power mode for the MCU, based on the peripheral(s) that is active.

(more…)

« Newer PostsOlder Posts »

Blog at WordPress.com.