Hello everyone,
I'm trying to port a language called Hume to the NXT, and since I'm mainly interested in this language, I'd like to take the lowest layer of leJOS to avoid having to reimplement peripheral handling. Unfortunately I'm not familiar with ARM development, let alone NXT hardware, and I'm running into certain problems I can't solve with fast hacks.
So far what I did was taking the platform/nxt directory, cutting all references to the VM and calling xx_show() to test the core functions. It worked well, so I took my own, apparently well-working program, which sat on top of a little bit of LCD display code yanked from the firmware, and tried to glue it to the leJOS core. The only functions I called were the ones used in xx_show(): display_*() and systick_wait_ms(). However, it simply didn't work. The symptoms were mind-boggling: data aborts at random times, consistently raised somwhere in i2c_timer_isr_C().
I started looking around a bit, and the only possible point of interference I saw was display_update(), more precisely nxt_spi_write(). Since the ISR writes to *AT91C_PIOA_{S,C}ODR, I decided to move their initialisation code inside the loop, so they are set for every byte sent. This seemed to solve the problem momentarily, but as soon as I changed my program a bit, data aborts returned. After this, I found that putting a little delay after each display update helps, but needless to say, I'm not really satisfied with such a fragile hack...
What's the real solution? What rules should I observe while using the core functions in order to avoid such conflicts?

