variable, size

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
frank

variable, size

Post by frank »

Why does the size of the kernel gets much bigger when you add a variable outside a function?
(which you give a value ofcourse)

example:

Code: Select all


unsigned char c = 5;

int main()
{

  while (1)
  {

  }

}

I' ve always worked around this (I always declared my variables inside the function).

I linked like this:

Code: Select all

gcc -c file.c
ld -o file -Ttext 0x1000 -e start file.o
objcopy -R .note -R .comment -S -O binary file file.bin
The Pro from Dover

Re:variable, size

Post by The Pro from Dover »

Good question, and one which has come up before. See reply #4 in this thread for Tim Robinson's explanation of the issue.
Post Reply