avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Creating a hole in the .text section


From: Peter Zuur
Subject: [avr-gcc-list] Creating a hole in the .text section
Date: Wed, 20 Oct 2004 11:29:41 +0200

I wrote a boot-loader for the Mega128 and I made a really dumb mistake by 
thinking that the __asm__ __volatile__ ("jmp 0xf000\n\t" ::) would jump to word 
address 0xf000. In reality, the avr-gcc assembler works with byte addresses and 
thus the jump is made to word address 0x7800. This was not an issue until my 
code size grew to 0xf000 (61440) bytes since the erased flash would cause the 
program counter to land up at the right address in any case. Now however some 
real code is sitting there and funny behaviour is obviously the result after 
using the boot-loader (which restarts itself after a load).

The solution to this is obviously putting a __asm__ __volatile__ ("jmp 
0x1e000\n\t" ::) at byte address 0xf000. It seems that the only way to do this 
is to create a new section at address 0xf000 and putting the jump in the 
special section. The linker now obviously complains that the .text and the new 
section overlap. How do I create a hole in the .text section to prevent this?

If anyone can help me I'll buy them a beer or twenty. It would really be a pain 
to place all future code in this new section.

Thanx

Peter

reply via email to

[Prev in Thread] Current Thread [Next in Thread]