Re: Boot loader issues

Georg-Johann Lay <[email protected]>
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <[email protected]>
larry barello schrieb:

> 1. How do I specify a long call from my application to jump into the
> boot-loader (which resides at 0x20000).  This is my solution:
> 
> 	case SMB_GOTO_BOOTLOADER:
> 		EIND = 1;	// HACK HACK
> 		((void (*)(bool bCalled))((BOOT_SECTION_START)/2))(true);
> 		break;

This is not supposed to work reliably, cf. "EIND and Devices with more 
than 128 Ki Bytes of Flash" in the avr-gcc manual.

> 2. How do I get Studio 6 to not include the C startup files?  I know how

1) -nostartfiles
2) Implement the startup bits from libgcc

If this does not work:  "Studio 6" is not a compiler.  It's some GUI. 
Consult your "Studio 6" support.

> 3. The boot loader C runtime sets RAMPZ=1 but the compiler insists on using
> indirect through Z to access I/O so it fails miserably in the boot section.
> I solved this problem by wrapping my various I/O routines (init, TWI
> handler, etc) with "RAMPZ=0; . RAMPZ=1;" Surely there is a better way.

avr-gcc assumes RAMPZ=0 always on devices that use RAMPZ on RAM.  YMMV 
depending on the distribution you are using.

> 4. It appears that the boot-loader pushes 116 bytes of stuff into the end of
> the APPTABLE section of FLASH.  It is avr-gcc jamming trampolines or
> something there?  How do I make that go away?  I don't need the loader and
> my applications fighting over that chunk of flash.

Try compiling with -fno-tree-switch-conversion, this works for implicit 
.rodata objects with names that start with "CSWTCH".  If there are no 
such objects, then clean up your source code, factor out the unneeded 
data, remove the data by objcopy or own ld script, ...

Johann
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.