Setting build parameters for a sub-tree of RTEMS sources
Ralf Corsepius
corsepiu at faw.uni-ulm.de
Tue Apr 25 11:37:59 UTC 2000
"John M. Mills" wrote:
>
> Nick,
>
> On Mon, 24 Apr 2000 Nick.SIMON at syntegra.bt.co.uk wrote:
> > 'Fraid I don't know the answer to John's question, but I'm most concerned
> > about problems with 'volatile' - can anyone shed any light on this?
>
> I don't know how general might be the problems, but the specifics are:
> 2) I am staying close to Ralf Crosepius' SH-1 BSP, which provides macro
> to read and write on-chip register. For example:
> 'c/src/exec/score/cpu/sh/rtems/score/sh_io.h' defines:
> '#define read8(addr) (*(volatile unsigned8 *) (addr))'
>
> so a line like:
> 'temp8 = read8(SOME_ONCHIP_REG);' should try to read the named byte.
>
FWIW: Similar constructs are used for Linux on almost any architecture
Linux supports (cf include/asm-*/io.h in Linux-2.2). They should be save
when being used with constants and ordinal types.
>
> I found the problem with enabling serial output, but I must assume it
> could be affecting my other hardware setup routines.
I am inclined to agree, because comparing the -O1 and -O4 compiled
assembly code of your hw_init.c doesn't show anything obvious:
Here is the relevant excerpt of 'diff hw_init.s-O1 hw_init.s-O4'
_bsp_hw_init:
mov.l r14, at -r15
- mov r15,r14
mov.w L54,r3
mov.w @r3,r1
- extu.w r1,r1
mov.w L55,r2
+ extu.w r1,r1
or r2,r1
mov.w r1, at r3
mov.w L56,r2
@@ -30,6 +21,7 @@
extu.w r1,r0
or #32,r0
mov.w r0, at r2
+ mov r15,r14
mov r14,r15
rts
mov.l @r15+,r14
The diff this fragment was taken from, was generated this way (using the
hw_init.c you posted in reply to Joel):
cd <build>/c/gensh2/lib/libbsp/sh/gensh2/startup
rm o-optimize/hw*
make CFLAGS=--save-temps CFLAGS_OPTIMIZE_V=-O1
mv hw_init.s hw_init.s-O1
rm o-optimize/hw*
make CFLAGS=--save-temps CFLAGS_OPTIMIZE_V=-O4
mv hw_init.s hw_init.s-O4
diff -u hw_init.s-O1 hw_init.s-O4
BTW: This should answer your initial question, too.
Ralf
--
Ralf Corsepius
Forschungsinstitut fuer Anwendungsorientierte Wissensverarbeitung (FAW)
Helmholtzstr. 16, 89081 Ulm, Germany Tel: +49/731/501-8690
mailto:corsepiu at faw.uni-ulm.de FAX: +49/731/501-999
http://www.faw.uni-ulm.de
More information about the users
mailing list