
Hi Albert,
On 01.02.2015 03:55, Albert ARIBAUD wrote:
When building a THumb-1-only target with CONFIG_SYS_THUMB_BUILD, some files fail to build, most of the time because they include mcr instructions, which only exist for Thumb-2.
Thos patch introduces a Kconfig option CONFIG_THUMB2 and uses it to select between Thumb-2 and ARM mode for the aforementioned files.
This code has been build-tested and run-tested on ED Mini V2, both with U-Boot and SPL.
Signed-off-by: Albert ARIBAUD albert.u.boot@aribaud.net
Thanks. This helped me to get Thumb-1 working on the x600 (SPEAr600 with ARM926EJS). Where I some size constraints. So for this patch:
Tested-by: Stefan Roese sr@denx.de
But I have another Thumb-1 related problem. I'm also including UBIFS in my board. And this results in these errors:
{standard input}: Assembler messages: {standard input}:695: Error: selected processor does not support Thumb mode `mrs r2,cpsr' {standard input}:696: Error: unshifted register required -- `orr r1,r2,#128' {standard input}:697: Error: selected processor does not support Thumb mode `msr cpsr_c,r1' {standard input}:711: Error: selected processor does not support Thumb mode `msr cpsr_c,r2' {standard input}:766: Error: selected processor does not support Thumb mode `mrs r2,cpsr' {standard input}:767: Error: unshifted register required -- `orr r4,r2,#128' {standard input}:768: Error: selected processor does not support Thumb mode `msr cpsr_c,r4' {standard input}:782: Error: selected processor does not support Thumb mode `msr cpsr_c,r2' make[2]: *** [fs/ubifs/super.o] Error 1 ...
This is because the UBIFS code uses the atomic_foo() functions and the bitops functions. Which call the local_irq_foo() functions. And these include the "msr/mrs" instructions, which seem to be unsupported in Thumb-1, similar to the "mcr" instruction.
I've "solved" this problem by adding these lines to the UBIFS Makefile:
+# some files can only build in ARM or THUMB2, not THUMB1 +ifdef CONFIG_SYS_THUMB_BUILD +ifndef CONFIG_HAS_THUMB2 +CFLAGS_lpt.o := -marm +CFLAGS_lpt_commit.o := -marm +CFLAGS_super.o := -marm +CFLAGS_tnc.o := -marm +CFLAGS_tnc_misc.o := -marm +endif +endif
But I'm not really happy with this "solution".
Another option would be to remove all the irq_off/_on stuff from the atomic_foo() and the bitops functions. We are running in a single-threaded environment after all in U-Boot. So there should be no need for such synch mechanisms. But these files are copied from Linux. And I really don't like to make changes to these files.
And ideas / comments welcome.
BTW: You can easily test this on your ED Mini board as well by enabling UBI & UBIFS support. Then you also should see those errors.
Thanks, Stefan