Content originally posted in LPCWare by micrio on Wed Jun 22 08:54:02 MST 2011
I am trying to run a small routine from RAM. The code works perfectly when running in flash. It has a loop in it that I want to run as fast as possible.
I mark the function with;
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]__attribute__[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]((section([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]".data"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])))[/SIZE]
and the generated code looks OK.
There is a XXX_veneer function created that contains;
2030: e51ff004 ldr pc, [pc, #-4] ; 2034 <__disp_bit_pat_veneer+0x4>
which I assume is OK.
My function seems to be in RAM as expected.
I get a HardFault at the call to the veneer. The actual call is;
disp_bit_pat ();
1856: f000 ebec blx 2030 <__disp_bit_pat_veneer>
I though that the BLX opcode was an indirect call through a register and not
an immediate value. Could this be the problem? Do I need to code this in assembly?
I must compile and debug with full optimization, anything less is too slow
in my application. It just won't work.
This is pretty simple and I am, no doubt, doing something wrong.
This is not moving the vector table, it is not a boot loader.
Thanks,
pete.