A cross-binutils is generally a bit easier to get hold of, and in particular
binutils-none-eabi (and binutils-arm-linux-gnueabi{,hf}) are available in
Debian Jessie while the equivalent cross gcc is not.

The only reason gcc/cpp are required are to strip the embedded Ruby code out
before handing to the assembler, we can achieve the same by opening a multiline
comment around the ruby instead. Care needs to be taken not to close the
comment prematurely hence "*/" is written in the one place it is used as
"\x2a/" (i.e. encoding the * in hex). Having done this we can pass the .S file
directly to the cross-as.

There is no change to the resulting header file.

Signed-off-by: Ian Campbell <i...@hellion.org.uk>
---
 fel-to-spl-thunk.S | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/fel-to-spl-thunk.S b/fel-to-spl-thunk.S
index 93350b3..08c7423 100644
--- a/fel-to-spl-thunk.S
+++ b/fel-to-spl-thunk.S
@@ -25,7 +25,12 @@
 /* Usage instructions: "ruby -x fel-to-spl-thunk.S > fel-to-spl-thunk.h" */
 /*************************************************************************/
 
-#if 0 
+/* Open a comment for gas.
+
+   Do not close the comment until after the Ruby code terminator (__END__).
+   Write the '*' '/' sequence of characters as "\x2a/" in string literals to
+   avoid doing so.
+
 #!/usr/bin/env ruby
 
 def tool_exists(tool_name)
@@ -40,19 +45,19 @@ toolchains = [
   "armv7a-hardfloat-linux-gnueabi-",
 ]
 
-toolchain = toolchains.find { |toolchain| tool_exists("#{toolchain}gcc") }
+toolchain = toolchains.find { |toolchain| tool_exists("#{toolchain}as") }
 abort "Can't find any ARM crosscompiler\n" unless toolchain
 
-system("#{toolchain}gcc -o #{$PROGRAM_NAME}.o -c #{$PROGRAM_NAME}")
+system("#{toolchain}as -o #{$PROGRAM_NAME}.o #{$PROGRAM_NAME}")
 exit($?.to_i) if $?.to_i != 0
 
 `#{toolchain}objdump -d #{$PROGRAM_NAME}.o`.each_line {|l|
     next unless l =~ /(\h+)\:\s+(\h+)\s+(\S+)\s+([^;]*)/
-    printf("\t0x%s, /* %8s:    %-10s %-28s */\n", $2, $1, $3, $4.strip)
+    printf("\t0x%s, /* %8s:    %-10s %-28s \x2a/\n", $2, $1, $3, $4.strip)
 }
 
 __END__
-#endif
+*/
 
 /*************************************************************************/
 
-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to