File tree Expand file tree Collapse file tree 6 files changed +2952
-0
lines changed Expand file tree Collapse file tree 6 files changed +2952
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ tas : tas.c
3
+ gcc -o tas tas.c
4
+
5
+ clean :
6
+ rm -f tas
7
+ rm -f * .bin
8
+ rm -f * .hex
9
+ rm -f * .s.s
10
+ rm -f * .s.diss
11
+
12
+
Original file line number Diff line number Diff line change
1
+
2
+ This is a thumb assembler derived directly from the assembler in my
3
+ thumbulator project. The thumulator version remains the primary
4
+ version/home.
5
+
6
+ I added some hardcoded machine code up front to get from arm to thumb
7
+ and then if you bl hexstring, I tack on machine code to implement that
8
+ function. hexstring takes r0 and prints it out on the uart in ascii.
9
+
10
+ Since I got it working I dont want to just discard it, but not sure
11
+ what I want to do with this...I provided binaries for the bootloaders
12
+ so that you dont have to have arm tools, which is why you would use tas
13
+ because you want to try asm but dont want to try or have failed to build
14
+ gnu binutils. tas should build most anywhere.
15
+
16
+ One simple test program provided, thats it
17
+
18
+ ./tas test.s
19
+
20
+ then use a bootloader to load test.s.bin. Since the test program + tas
21
+ require the mini uart to be initialized simply copying test.s.bin to
22
+ kernel.img wont do you any good.
Original file line number Diff line number Diff line change
1
+
2
+ .globl _start
3
+ _start:
4
+ b reset
5
+ reset:
6
+ ldr sp,stack_start
7
+ ldr r0,thumb_start_add
8
+ bx r0
9
+
10
+ stack_start: .word 0x1000
11
+ thumb_start_add: .word thumb_start
12
+ .word 0
13
+ .word 0
14
+
15
+ .thumb
16
+ .thumb_func
17
+ thumb_start:
18
+ b .
Original file line number Diff line number Diff line change
1
+
2
+ void uart_send ( unsigned int );
3
+ void hexstring ( unsigned int d )
4
+ {
5
+ //unsigned int ra;
6
+ unsigned int rb ;
7
+ unsigned int rc ;
8
+
9
+ rb = 32 ;
10
+ while (1 )
11
+ {
12
+ rb -= 4 ;
13
+ rc = (d >>rb )& 0xF ;
14
+ if (rc > 9 ) rc += 0x37 ; else rc += 0x30 ;
15
+ uart_send (rc );
16
+ if (rb == 0 ) break ;
17
+ }
18
+ uart_send (0x0D );
19
+ uart_send (0x0A );
20
+ }
21
+ #define AUX_MU_IO_REG (*((volatile unsigned int *)0x20215040))
22
+ #define AUX_MU_LSR_REG (*((volatile unsigned int *)0x20215054))
23
+ void uart_send ( unsigned int x )
24
+ {
25
+ while (1 )
26
+ {
27
+ if (AUX_MU_LSR_REG & 0x20 ) break ;
28
+ }
29
+ AUX_MU_IO_REG = x ;
30
+ }
You can’t perform that action at this time.
0 commit comments