I found my J-Link lying around and tried again to get IAR to play nice with an NXP ARM7, and I'm heading to the conclusion that this toolchain simply doesn't work with NXP. Here's what happens - it's really weird, so maybe someone can explain:
- Create an empty C main project (main just returns 0)
- Select the correct chip as target
- Select J-Link as the debugger
- Uncheck the "run to main" box
Starting debug, you can single-step through the startup code until it jumps to ?main, where it encounters this code:
?main: 00000180 E3A00001 MOV R0, #0x1 00000184 EBFFFFF4 BL ?Veneer (0) for __low_level_init ;
0x15C 00000188 E3500000 CMP R0, #0x0 0000018C 1BFFFFCF BLNE __iar_data_init2 ; 0xD0 __iar_init$$done: 00000190 E3A00000 MOV R0, #0x0 00000194 EBFFFFF3 BL ?Veneer (0) for main ; 0x168Here's where it gets weird. When you try to step over the BLNE instruction, the J-Link programming window pops up again, and the debugger doesn't get to the next instruction - it looks like it's still running. Hitting the break button shows that the CPU is now stuck at the abort vector. It never reaches main.
Same behavior, though slightly different code, if ARM mode is selected rather than Thumb. I've tried this on a Keil MCB2130 (LPC2138) and an Olimex LPC2106 board, identical results. Does anyone have a clue what could be causing this?
It's really whacked out. IAR's sales rep has called me several times asking if I'm going to write a check for $4,000 for a single node license for this compiler. Quite the comedian.