I am using CCS 5.5 to program a Beaglebone Black. I can successfully get up and running with JTAG.
I am now trying to start blinking LEDs. In order to do this I need to configure GPIO1. In trying to configure this port I have found that TI's C runtime immediately goes to user mode (4 instructions from startup). When I try reading or writing the control memory locations I get an error that we believe is caused by not being in supervisor mode.
In order to get in to supervisor mode I am attempting to write a software interrupt handler and then do the necessary configuration from there. I can write the handler, and I can get main()
to call a software interrupt, but I am struggling trying to get my interrupt handler to actually work.
#pragma SWI_ALIAS(7);
int function(int i);
#pragma INTERRUPT(SWI);
int function(int i)
{
return i + 1;
}
int main(void) {
int i = function(5);
while(1);
}
Calls to function
produce SWI 7
in the disassembly, as I would expect, but function
is never called. I have written a intvecs.asm file, but that didn't help.
.global _c_int00
.global _Z8functioni
.retain ".intvecs"
.sect ".intvecs"
B _c_int00 ; reset interrupt
.word 0 ; undefined instruction interrupt
B _Z8functioni ; software interrupt
.word 0 ; abort (prefetch) interrupt
.word 0 ; abort (data) interrupt
.word 0 ; reserved
.word 0 ; IRQ interrupt
.word 0 ; FIQ interrupt
I would appreciate any suggestions on how to get this working.
It appears that the .gel file that comes with CCS 5.5 doesn't actually permit writing to 0x00000000, which, to my understanding, is the location of the interrupt vectors. So the JTAG adapter isn't updating the interrupt vector.