[CCC DEV] A confusing test that should have died

Matt Jadud jadudm at gmail.com
Wed Jun 23 16:20:55 BST 2010


Hi all,

I was working on serial on the Mega this morning, and some of our code
didn't die that probably should have. The test is here:

http://projects.cs.kent.ac.uk/projects/kroc/trac/browser/kroc/branches/avr-mega/tvm/arduino/occam/examples/arduinomega/all-serial.occ

It uses interrupt-driven serial to output to USART1, reads on 2,
outputs on 2, reads on 3, and then outputs on 3, which I read on the
host. This works.

Perhaps it shouldn't?

The serial routines in io.module for this platform (specifically,
serial.write.byte) include a call the FFI "wait.for.interrupt":

http://projects.cs.kent.ac.uk/projects/kroc/trac/browser/kroc/branches/avr-mega/tvm/arduino/occam/include/arch/m1280/io.module#L131

Well... "ffi_wait_for_interrupt" has some logic in it that is not
doing its job (it seems); specifically, on line 153:

http://projects.cs.kent.ac.uk/projects/kroc/trac/browser/kroc/branches/avr-mega/tvm/arduino/interrupts.c#L153

We should return SFFI_ERROR when an interrupt number exceeds the size
of our enumeration table in "interrupts.c". I'm passing it interrupt
numbers as high as 56... which should cause something to choke, no?

That said, the example code seems to work perfectly... which is why
I'm bothered. Debugging to follow. Upsights appreciated.

Cheers,
Matt

-- 
Sent from my TRS-80




More information about the developers mailing list