I'm trying to write some code for the PRU in the OMAP-L138 using PASM, and I've run into some odd troubles. I think either the assembler or the hardware has a bug.
I have a u8, global.flags, set to 0x04. I'm trying to set bit 1, which would make it 0x06, then store it to memory. Because of my troubles, I boiled it down to two sequential instructions:
SET global.flags, 1
SBBO global.flags, config.dest, 0, 1
This code results in 0x04 stored in the memory location pointed to by config.dest (a u32). NOT my intended result! However,
SET global.flags, 0
SBBO global.flags, config.dest, 0, 1
results in 0x05, and
SET global.flags, 3
SBBO global.flags, config.dest, 0, 1
results in 0x0C. Both of these results act as expected simply using different constants. Furthermore, I can get my desired result with a workaround:
LDI tmp.i, 1 // loads my desired bit into a u8 register
SET global.flags, tmp.i
SBBO global.flags, config.dest, 0, 1
It clearly looks as if I can't set a bit using an immediate 1, but I can set it using a 1 stored in another register or any other bit with a different immediate value. I saw a similar behavior earlier using the ADD instruction, only that time the immediate that failed to work was 0x10. Are there any known errata for the PRU or PASM that might explain this behavior? I'm running the Windows version 0.70 of pasm.exe on Windows 7.