<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>I found FPC_HAS_SYSTEMS_INTERRUPT_TABL, enabled it - but it was still broken for Thumb2 (stellaris, stm32).<br><br>For Thumb2, it was broken in the following ways:<br><br>1) Stack_top should be placed at vector 0.<br>2) Each address should have the LSB set - to "force" Thumb mode when the PC gets loaded with that value.<br><br>I defined FPC_HAS_SYSTEMS_INTERRUPT_TABLE a little further down - so that was only enabled on ARM and AVR (trying not to break other things...)<br><br>I also have some added logic in ncgutil - for M3 devices - to place the stack_top into vector 0, then place handlers for vectors 1 to TOP. The WriteVector routine for Thumb also adds an offset of 1 to each vector - so as to force Thumb mode upon load to PC.<br><br>John<br> </div><div style="font-family:times new
roman, new york, times, serif;font-size:12pt"><br><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Jeppe Gręsdal Johansen <jjohan07@student.aau.dk><br><b><span style="font-weight: bold;">To:</span></b> FPC developers' list <fpc-devel@lists.freepascal.org><br><b><span style="font-weight: bold;">Sent:</span></b> Sun, August 21, 2011 7:27:48 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [fpc-devel] Arm Thumb2 - Stellaris status<br></font><br>
<meta http-equiv="x-dns-prefetch-control" content="off">
Den 21-08-2011 17:06, Geoffrey Barton skrev:
<blockquote type="cite">
<base><br>
<div>
<div>On 21 Aug 2011, at 15:33, John Clymer wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite"><span class="Apple-style-span" style="border-collapse:separate;font-family:Verdana;font-style:normal;font-variant:normal;
font-weight:normal;letter-spacing:normal;line-height:normal;orphans:2;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;
font-size:medium;">
<div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;
font-family:times, serif;
font-size:12pt;">
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;">As part of my
table-ization of cpuinfo.pas, I am including a generic
part for each (no code published for this yet.) The
caveat to this is that FLASH size and SRAM sizes are
just set to extremely large (1 MB each for now).
Which means if the code size exceeds the space of the
device - the compiler/linker will not catch the
overflow of the available resource. (Running objsize
on the ELF file will display the sizes - so I just run
that after every successful compile.)<br>
</div>
</div>
</div>
</span></blockquote>
<div><br>
</div>
As I pointed out, this will always fail because the stacktop is
set beyond the available ram. It will cause an exception I
think. How do you propose to be able to set the actual ram top
for the generic part, or am I missing something?</div>
<div><br>
<blockquote type="cite"><span class="Apple-style-span" style="border-collapse:separate;font-family:Verdana;font-style:normal;font-variant:normal;
font-weight:normal;letter-spacing:normal;line-height:normal;orphans:2;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;
font-size:medium;">
<div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;
font-family:times, serif;
font-size:12pt;">
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;"><br>
Also, still testing, but I have the "<span style="font-weight:bold;">interrupt"<span class="Apple-converted-space"> </span></span>reserved
word working (more or less, more testing needed.)
This takes the interrupt codeword with an integer.
The integer is the offset into the vectors table. If
no interrupt is provided for the given address, it
defaults to DefaultHandler in the startup file - which
is just a continual loop - so one can breakpoint on
it. (This can be enabled / disabled via a define in
the source.) This is should only be enabled for the
embedded target - but I need to double check to ensure
that is the case.<br>
</div>
</div>
</div>
</span></blockquote>
<div><br>
</div>
This is a useful development; ideally the integer would be
backed by an enumeration as it is a big table. One thing which I
did find missing was the interrupt enable and disable assembler
codes, so I patched them with data bytes hidden in functions.
The keil C compiler does not like these if you link to units
doing this (throws a data/code wobbly). See the file attached to
bug tracker ID<span class="Apple-style-span" style="
color:rgb(17, 17, 17);font-family:Arial, Verdana, sans-serif;">0017365 for how I hacked
interrupts.</span></div>
</blockquote>
The CPS* instruction with the correct operand syntax was added in
#18334<br>
<br>
SVN trunk already has experimental support for the interrupt
keyword. It's enabled with FPC_HAS_SYSTEMS_INTERRUPT_TABLE in
fpcdefs.inc. I discovered a small bug with the current
implementation which is fixed with the attached patch(which also
includes some other stuff... the bugfix is in ncgutil. It didn't
search the program file for interrupt handlers before)<br>
<meta http-equiv="x-dns-prefetch-control" content="on"></div></div></div></body></html>