dibosco wrote on Monday, November 10, 2014:
Folks,
I’ve spent a day, along with the help of the chaps at Rowley trying to get an old project working that I had going years ago with a much older version of FreeRTOS.
With the up-to-date version of FreeRTOS it will not work.
The lwIP_Demo_Rowley_ARM7 is the project in question. Originally, when I started to compile it this time round I had really strange issues whereby when it compiled it only linked in about 5k of code and used less than 1k of RAM. Michael at Rowley gave me a fix for that which I’ll submit as a possible bug fix. I guess it’s an incompatibility issue with an older version of Crossworks.
However, even when the errors were fixed and it compiled correctly, I couldn’t load the program properly and couldn’t erase the flash memory at all.
I’m using the AT91SAM7X-EK and I know it’s not an issue with that, because an “hello world” program loads and executes just fine.
So, I recreated the whole project with v3 of Crossworks and that does now program the flash just fine. However, it crashes in portRESTORE_CONTEXT() in portmacro.h which is called from vPortISRStartFirstTask
I believe I am using the correct portmacro.h file. I am sure it is the same one that was in the original demo.
The preprocessor and the portmacro says the code should be:
LDR R0, =pxCurrentTCB
LDR R0, [R0]
LDR LR, [R0]
LDR R0, =ulCriticalNesting
LDMFD LR!, {R1}
STR R1, [R0]
LDMFD LR!, {R0}
MSR SPSR, R0
LDMFD LR, {R0-R14}^
NOP
LDR LR, [LR, #+60]
SUBS PC, LR, #4
However, the dissasembled code is this:
E59F004C ldr r0, 0x00103910
E5900000 ldr r0, [r0]
E590E000 ldr lr, [r0]
E59F0044 ldr r0, 0x00103914
E8BE0002 ldm lr!, {r1}
E5801000 str r1, [r0]
E8BE0001 ldm lr!, {r0}
E169F000 msr spsr_cf, r0
E8DE7FFF ldmia lr, {r0-lr}^
E1A00000 mov r0, r0
E59EE03C ldr lr, [lr, #0x3C]
E25EF004 subs pc, lr, #4
E59F3014 ldr r3, 0x00103908
E5933000 ldr r3, [r3]
E59F3010 ldr r3, 0x0010390C
E5933000 ldr r3, [r3]
It’s at the line of disassembled code:
E25EF004 subs pc, lr, #4
That is crashes, although the few lines above differ from what is, supposedly the source code.
lr contains 0x00001a20
pc contains 0x001038e8
Does that give enough info to maybe point me in the direction of why this is crashing?
Many thanks,
Rob