public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Found Error in link-script for R8C
@ 2007-01-19 23:25 Olaf Kaluza
  2007-01-19 23:55 ` DJ Delorie
  0 siblings, 1 reply; 2+ messages in thread
From: Olaf Kaluza @ 2007-01-19 23:25 UTC (permalink / raw)
  To: gcc-bugs


Hello to everyone,

I found an Error with gcc-4.1.1 and binutils-2.17 when using it for
crosscompiling source for Renesas R8C Microcontroller. (m32c-elf)

In the file r8c.ld you can find this line:

 RESETVEC (r) : ORIGIN = 0xfffc, LENGTH = 4

But this is wrong. The Resetvektor for  R8C is only 16Bit and not
32bit. When you write 32Bit value to 0xfffc it writes a 0x00 in
Adress 0xffff, but this is the Register OFS. 
After this the watchdog is switched on and the controller is only
working for short time.

If you try this, please understand that it is not enought to reset
the controller by the reset button on your testboard. 
Only after power-off->power-on the controller use the new OFS byte.

Olaf

p.s: I am not subscribed to this list. For question please email me.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Found Error in link-script for R8C
  2007-01-19 23:25 Found Error in link-script for R8C Olaf Kaluza
@ 2007-01-19 23:55 ` DJ Delorie
  0 siblings, 0 replies; 2+ messages in thread
From: DJ Delorie @ 2007-01-19 23:55 UTC (permalink / raw)
  To: olaf; +Cc: gcc-bugs


> Hello to everyone,

Wrong list.  The R8C link scripts are part of newlib (libgloss), not
gcc.

>  RESETVEC (r) : ORIGIN = 0xfffc, LENGTH = 4
> 
> But this is wrong. The Resetvektor for  R8C is only 16Bit and not
> 32bit.

The REJ09B0169-0100 page 61 shows the reset vector as being "0FFFCh to
0FFFFh".  Addresses in R8C are 20 bits, not 16, and are normally
stored in a 3 or 4 byte location.  The R8C/2D, for example, is
available with 96K of flash.

> When you write 32Bit value to 0xfffc it writes a 0x00 in Adress
> 0xffff, but this is the Register OFS.  After this the watchdog is
> switched on and the controller is only working for short time.

My flash utility has a command line option for whether the watchdog
should be set or disabled.  It overrides this byte before programming.

Note that all the vectors in the interrupt and reset vector tables are
essentially three byte values, with the top byte used for other
purposes.

Hmmm... I thought there was a .3byte pseudo-op just for this case, but
I see now that there isn't.  With it, you could do this:

	.section ".resetvec"
	.3byte _start
	.byte 0xff

If you know your start address is in the first 64k, you can do this:

	.section ".resetvec"
	.short	_start
	.byte	0
	.byte	0xff


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-01-19 23:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-19 23:25 Found Error in link-script for R8C Olaf Kaluza
2007-01-19 23:55 ` DJ Delorie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).