Jump tables for gcc-arm cross compiler

Guest #3354572
I would really appreciate if some one could tell me how to initiate jump 
tables for gnu arm assembler. I have written the below code at the end 
of my .s file. I have tried all sorts of things (using .align, .p2align, 
.long etc) but i can't get the _input_case_table to get the 4 byte 
addresses for str_help and str_sum. Assuming input starts at 0x100e4 
memory in the debugger, I have reproduced the 32 byte memory location 
following it.
1
/*
2
 * --- Data follows ---
3
 */
4

5

6
/* Let's pretend this command was entered by the user */
7
input:  .ascii "sum"
8
  .byte 0, 0, 0, 0, 0
9
  
10
str_help:
11
  .ascii "HELP"
12
  .byte 0, 0, 0, 0
13
str_sum:
14
  .ascii "SUM"
15
  .byte 0, 0, 0
16

17
/* Recognized commands */
18
_input_case_table:
19
  .word  str_sum
20
  .word  str_help

---------_GDB_MEMORY_OUTPUT-------------------
Attached in file

I am using the gcc-4.6-linux-arm-gnueabi compiler tool chain. Using 
gdb-multiarch with architecture set to armv4.
I am still new to this so any guidance would be much appreciated.

To reiterate my question, im tyring to compile code for armv4 32bit 
processor mode. I know how alignment and 'DCD' statements work but for 
Keil Development tools only. I would really appreciate if some one could 
point me how to do the using the GNU assembler.
Attached files:
Did you find out?

Surprisingly, I use your style since years, successfully.
Most recently for LPC800:
1
.text
2
.thumb
3
vectorTable:
4
        initialSP:      .word   0
5
        initialPC:      .word   _start+1
6

7

8
.global _start
9
_start:
10
        ...
The only difference is the presence of the labels.

Reply

A question of your own? This thread is over 13 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.