I now have a working cross-compiler and a C runtime environment and libc based on gcc 4.9.2 and newlib 1.18.0 with floating point emulation. I have created a linker script for the T030 along with some startup code and the first prototype of my own C based ROM monitor is now ready:
T030 ROM BIOS v1.00
-------------------
Checking RAM: 512 KB OK
#> h
d - Dump address: d
h - Help
g - Run: g
r - Dump registers
u - Run in user mode: u
w - Write single byte: w
x - Transfer file with XMODEM: x
#> x 90000
Starting XMODEM receive...
CCC
Done, bytes received: 36992, write errors: 0
#> g 90000
T030 TEST MONITOR v0.02
-----------------------
*> r
SR: 2100
SSP: 000fffa0
USP: fffffffe
VBR: 00080000
CACR: 00000000
*> g 000000
Exception #4 (illegal instruction) SR: 2104 PC: 00000000
A simple interrupt routine to use one of the MFP timers to blink a led can be written like this:
void __attribute__ ((interrupt)) timerb_isr()
{
static uint8_t c;
if (c++ >= 50)
{
if (bit_is_clear(MFPGPDR, 0))
bit_set(MFPGPDR, 0);
else
bit_clear(MFPGPDR, 0);
c = 0;
}
}
void enable_led()
{
MFPTBCR = 0;
MFPTBDR = 255;
// enable interrupt for timer B
bit_set(MFPIERA, 0);
bit_set(MFPIMRA, 0);
set_vector(72, timerb_isr);
// start timer B
MFPTBCR = 7;
}
I have also updated the glue logic in the CPLD so the CPU now runs at the full speed, a whopping 25 Mhz.
Tobias Rathje
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.