summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2015-09-18 18:07:08 +1000
committerDamien Zammit <damien@zamaudio.com>2015-09-18 18:07:08 +1000
commit13c097b70bc3350b3b6f407190c0e09a77cd4dfe (patch)
tree5bc86d0599c63e91cf787b77415bf82a200c90df
parentaca27f36c91fdf84f96f44b16c0652a928b30946 (diff)
Moved regs earlier in memory map, fixed inline ops
Signed-off-by: Damien Zammit <damien@zamaudio.com>
-rw-r--r--firmware/Makefile2
-rw-r--r--firmware/ops.h46
-rw-r--r--firmware/smu.ld4
3 files changed, 31 insertions, 21 deletions
diff --git a/firmware/Makefile b/firmware/Makefile
index c26a638..baf3a5e 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -28,7 +28,7 @@ OPT=-Os
all: $(TARGET)
$(TARGET): $(OBJS) $(OBJS2)
- $(LD) $(LIBS) $(OBJS) $(OBJS2) -static -M -T smu.ld -o $(TARGET) >/dev/null
+ $(LD) $(OPT) $(LIBS) $(OBJS) $(OBJS2) -static -M -T smu.ld -o $(TARGET) >/dev/null
$(OC) -S -I elf32-lm32 -O binary $(TARGET) smu.rom
.c.o:
diff --git a/firmware/ops.h b/firmware/ops.h
index 50a52f4..8b48333 100644
--- a/firmware/ops.h
+++ b/firmware/ops.h
@@ -16,15 +16,7 @@
#ifndef _OPS_H
#define _OPS_H
-extern int __mulsi3 (int a, int b);
-extern int __lshrsi3 (int a, int b);
-extern int __lshlsi3 (int a, int b);
-extern int __ashrsi3 (int a, int b);
-extern int __ashlsi3 (int a, int b);
-extern unsigned int __udivsi3 (unsigned int a, unsigned int b);
-extern int __divsi3 (int a, int b);
-
-extern int __mulsi3 (int a, int b)
+inline int __mulsi3 (int a, int b)
{
int c;
asm ("mul %0, %1, %2"
@@ -35,17 +27,29 @@ extern int __mulsi3 (int a, int b)
return c;
}
-extern int __lshrsi3 (int a, int b)
+inline int __lshrsi3 (int a, int b)
{
- return __ashrsi3(a,b);
+ int c;
+ asm ("sr %0, %1, %2"
+ :"=r"(c)
+ :"r"(a),"r"(b)
+ :
+ );
+ return c;
}
-extern int __lshlsi3 (int a, int b)
+inline int __lshlsi3 (int a, int b)
{
- return __ashlsi3(a,b);
+ int c;
+ asm ("sl %0, %1, %2"
+ :"=r"(c)
+ :"r"(a),"r"(b)
+ :
+ );
+ return c;
}
-extern int __ashrsi3 (int a, int b)
+inline int __ashrsi3 (int a, int b)
{
int c;
asm ("sr %0, %1, %2"
@@ -56,7 +60,7 @@ extern int __ashrsi3 (int a, int b)
return c;
}
-extern int __ashlsi3 (int a, int b)
+inline int __ashlsi3 (int a, int b)
{
int c;
asm ("sl %0, %1, %2"
@@ -67,7 +71,7 @@ extern int __ashlsi3 (int a, int b)
return c;
}
-extern unsigned int __udivsi3 (unsigned int a, unsigned int b)
+inline unsigned int __udivsi3 (unsigned int a, unsigned int b)
{
unsigned int c;
asm ("divu %0, %1, %2"
@@ -78,8 +82,14 @@ extern unsigned int __udivsi3 (unsigned int a, unsigned int b)
return c;
}
-extern int __divsi3 (int a, int b)
+inline int __divsi3 (int a, int b)
{
- return ((int)__udivsi3((unsigned int)a, (unsigned int)b));
+ unsigned int c;
+ asm ("divu %0, %1, %2"
+ :"=r"(c)
+ :"r"(a),"r"(b)
+ :
+ );
+ return c;
}
#endif
diff --git a/firmware/smu.ld b/firmware/smu.ld
index 0882b46..67bdc73 100644
--- a/firmware/smu.ld
+++ b/firmware/smu.ld
@@ -34,8 +34,8 @@ MEMORY
{
rom : ORIGIN = 0x0, LENGTH = 0x10000
header : ORIGIN = 0x00010000, LENGTH = 0x100
- ram : ORIGIN = 0x00010100, LENGTH = 0xef00
- regs : ORIGIN = 0x0001f000, LENGTH = 0x1000
+ ram : ORIGIN = 0x00010100, LENGTH = 0xcf00
+ regs : ORIGIN = 0x0001d000, LENGTH = 0x3000
}
SECTIONS