adding thumb assembler, cant decide if I really want this here
This commit is contained in:
12
tas/Makefile
Normal file
12
tas/Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
tas : tas.c
|
||||
gcc -o tas tas.c
|
||||
|
||||
clean :
|
||||
rm -f tas
|
||||
rm -f *.bin
|
||||
rm -f *.hex
|
||||
rm -f *.s.s
|
||||
rm -f *.s.diss
|
||||
|
||||
|
||||
22
tas/README
Normal file
22
tas/README
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
This is a thumb assembler derived directly from the assembler in my
|
||||
thumbulator project. The thumulator version remains the primary
|
||||
version/home.
|
||||
|
||||
I added some hardcoded machine code up front to get from arm to thumb
|
||||
and then if you bl hexstring, I tack on machine code to implement that
|
||||
function. hexstring takes r0 and prints it out on the uart in ascii.
|
||||
|
||||
Since I got it working I dont want to just discard it, but not sure
|
||||
what I want to do with this...I provided binaries for the bootloaders
|
||||
so that you dont have to have arm tools, which is why you would use tas
|
||||
because you want to try asm but dont want to try or have failed to build
|
||||
gnu binutils. tas should build most anywhere.
|
||||
|
||||
One simple test program provided, thats it
|
||||
|
||||
./tas test.s
|
||||
|
||||
then use a bootloader to load test.s.bin. Since the test program + tas
|
||||
require the mini uart to be initialized simply copying test.s.bin to
|
||||
kernel.img wont do you any good.
|
||||
18
tas/armstart.s
Normal file
18
tas/armstart.s
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
b reset
|
||||
reset:
|
||||
ldr sp,stack_start
|
||||
ldr r0,thumb_start_add
|
||||
bx r0
|
||||
|
||||
stack_start: .word 0x1000
|
||||
thumb_start_add: .word thumb_start
|
||||
.word 0
|
||||
.word 0
|
||||
|
||||
.thumb
|
||||
.thumb_func
|
||||
thumb_start:
|
||||
b .
|
||||
30
tas/hexstring.c
Normal file
30
tas/hexstring.c
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
void uart_send ( unsigned int );
|
||||
void hexstring ( unsigned int d )
|
||||
{
|
||||
//unsigned int ra;
|
||||
unsigned int rb;
|
||||
unsigned int rc;
|
||||
|
||||
rb=32;
|
||||
while(1)
|
||||
{
|
||||
rb-=4;
|
||||
rc=(d>>rb)&0xF;
|
||||
if(rc>9) rc+=0x37; else rc+=0x30;
|
||||
uart_send(rc);
|
||||
if(rb==0) break;
|
||||
}
|
||||
uart_send(0x0D);
|
||||
uart_send(0x0A);
|
||||
}
|
||||
#define AUX_MU_IO_REG (*((volatile unsigned int *)0x20215040))
|
||||
#define AUX_MU_LSR_REG (*((volatile unsigned int *)0x20215054))
|
||||
void uart_send ( unsigned int x )
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
if(AUX_MU_LSR_REG&0x20) break;
|
||||
}
|
||||
AUX_MU_IO_REG=x;
|
||||
}
|
||||
7
tas/test.s
Normal file
7
tas/test.s
Normal file
@@ -0,0 +1,7 @@
|
||||
mov r7,#0
|
||||
top:
|
||||
mov r0,r7
|
||||
bl hexstring
|
||||
add r7,#1
|
||||
b top
|
||||
|
||||
Reference in New Issue
Block a user