[okl4-developer] Problem with inline assembler on arm926ejs
Lukas HANEL
lukas.hanel at st.com
Thu Apr 17 00:41:37 EST 2008
Hi Gabi,
thanks for your help. But in fact I am not the author of the problematic
code and I do not have in mind to understand or debug it. The code comes
from the 1.5.2 release and does not compile, so I was addressing the
OKL4 support to provide a correct version.
My first attempt was of course to understand and possible correct the
problem. But as I don't know what the function is supposed to do and how
it tries to achieve it and when not even finding what the _(xx) syntax
means, I was giving up and directing me to the list.
I find the following reference very enlightning:
Brennan's Guide to Inline Assembly
http://www.delorie.com/djgpp/doc/brennan/brennan_att_inline_djgpp.html
Gabi Voiculescu wrote:
> Personally I would use another way to write this (use zero as an
> output register instead of passing it as clobber stuff to the GCC,
> notice how many ':' I use)
>
> static inline void sleep(void)
> {
> #if defined(__GNUC__)
> word_t zero = 0;
> __asm__ __volatile__ (
> " mcr p15, 0, %0 , c7, c0, 4 \n" /* Wait for interrupt */
> : "=r" (zero) );
> #endif
> }
>
> Incidentally, I think you got that error because you used "_(zero)"
> instead of "(zero)".
>
> I recommend for you to also look at the following source to explain
> the how to on GCC inline assembly for ARM:
> http://www.ethernut.de/en/documents/arm-inline-asm.html
>
>
> Gabi Voiculescu
>
>
> */Lukas HANEL <lukas.hanel at st.com>/* wrote:
>
> Hi
>
> I am trying to port OKL4 to a platform based on the arm926ejs core.
> Therefore I copied the xscale platform folder and changed the
> tools/machines.py to be based on an other processor architecture.
> E.g.
> < class pxa(xscale):
> > class pxa(arm926ejs):
>
> Trying to compile this gave me an error related to cryptic inline
> assembler code.
> However it seems, that the same code is working in other files, so
> I am
> confused.
> The problem occures in arm926ejs/cpu.h, but nearly the same code
> is used
> in arm926ejs/cache.h
> A similar syntax can be found in cache.h of other architectures.
> Do you have a good reference for the inline assembly language?
>
> Thanks
> Lukas
>
> Listing:
> ~/okl4_release_1.5.2nhk$ ./tools/build.py machine=nhk15 project=iguana
> example=naming simulate --debug=presub
> scons: Reading SConscript files ...
> Warn: No serial driver configured, not building serial server
> SERIAL_DRIVER is uart_8250
> scons: done reading SConscript files.
> scons: Building targets ...
> [CXX ] build/pistachio/l4kernel/object/src/cache.o
> In file included from platform/pxa/pistachio/include/plat/timer.h:92,
> from arch/arm/pistachio/include/arch/config.h:377,
> from pistachio/include/config.h:146,
> from pistachio/include/l4.h:70,
> from pistachio/src/cache.cc:65:
> arch/arm/pistachio/cpu/arm926ejs/include/cpu/cpu.h: In static member
> function `static void arm_cpu::sleep()':
> arch/arm/pistachio/cpu/arm926ejs/include/cpu/cpu.h:99: error: expected
> `)' before "_"
> arch/arm/pistachio/cpu/arm926ejs/include/cpu/cpu.h:97: warning: unused
> variable 'zero'
> scons: *** [build/pistachio/l4kernel/object/src/cache.o] Error 1
> scons: building terminated because of errors.
>
> arch/arm/pistachio/cpu/arm926ejs/include/cpu/cpu.h:
> static inline void sleep(void)
> {
> word_t zero = 0;
> __asm__ __volatile__ (
> " mcr p15, 0, "_(zero)", c7, c0, 4 ;" /* Wait for
> interrupt */
> #if defined(__GNUC__)
> :: [zero] "r" (zero)
> #endif
> );
> }
>
>
> _______________________________________________
> Developer mailing list
> Developer at okl4.org
> https://lists.okl4.org/mailman/listinfo/developer
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Developer mailing list
> Developer at okl4.org
> https://lists.okl4.org/mailman/listinfo/developer
>
More information about the Developer
mailing list