Re: RE : RE : [fpc-pascal] Variable alignment in arm-embedded

2012-06-13 Thread alrieckert

Florian Klämpfl wrote
> 
> Better submit a bug tracker entry. This way it cannot get lost.
> 

Hi Florian,
Thank you, I do have an open bug on this issue here
http://bugs.freepascal.org/view.php?id=22146 Freepascal Bug ID 22146 
--
Regards
Anton Rieckert


--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Variable-alignment-in-arm-embedded-tp5709962p5710047.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : [fpc-pascal] Variable alignment in arm-embedded

2012-06-12 Thread Florian Klaempfl

Am 11.06.2012 13:46, schrieb alrieckert:

Hi Jeppe,

I've been using the actual ROM based interrupt table for the past
month now in freepascal ad it seems to work great. No need to declare
a block of RAM and pointing the interrupt table to it.

You can code any procedure and just give it the interrupt keyword
with an address index.

For example:



There are 3 patches you need to apply to your compiler. I'll try to
submit the patches to the Freepascal mailing list and hopefully
someone will accept them, but in the mean time you can find them
here.


Better submit a bug tracker entry. This way it cannot get lost.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : [fpc-pascal] Variable alignment in arm-embedded

2012-06-12 Thread Florian Klaempfl

Am 12.06.2012 09:50, schrieb Koenraad Lelong:

On 08-06-12 14:37, Jeppe Græsdal Johansen wrote:

Den 08-06-2012 14:28, Ludo Brands skrev:

Thanks Ludo,

I'll take that as a starting point. I hope I will not need the "lost"
256 bytes in the future.

I could be wrong but AFAIK if the compiler would do the alignment, the
loss
can also be up to 255 bytes. Here you lose 256 bytes in all cases.

Yes, but this would allow the linker to place other stuff there which
fits in less than 255 bytes.

Wasting 255 bytes is a lot on systems that only has a few kilobytes of
RAM. I wonder if the restriction of 32 bytes on the align directive
could just be removed, or will we need some sort of linker script
changes?


Hi,

I'm still struggling to get interrupts (or even inputs) work but I
wanted to comment on the size of the table. Reading the manuals I found
it's actually on a 512 byte boundery. The VTOR (Vector Table Offset
Register) masks off the last 9 bits (8..0).
If I need that space I will modify the start of RAM location and use the
first bytes of RAM for the vector-table.
It would be nice to have "external" linker scripts. That way you could
more easily add processors,


I think extending t_embedded.pas is the more clean solution to add new 
controllers, especially because it makes it easier for other people to 
use the added controllers.



or use custom bootloaders.

Regards,

Koenraad Lelong.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : [fpc-pascal] Variable alignment in arm-embedded

2012-06-12 Thread Florian Klaempfl

Am 08.06.2012 14:37, schrieb Jeppe Græsdal Johansen:

Den 08-06-2012 14:28, Ludo Brands skrev:

Thanks Ludo,

I'll take that as a starting point. I hope I will not need the "lost"
256 bytes in the future.

I could be wrong but AFAIK if the compiler would do the alignment, the
loss
can also be up to 255 bytes. Here you lose 256 bytes in all cases.

Yes, but this would allow the linker to place other stuff there which
fits in less than 255 bytes.

Wasting 255 bytes is a lot on systems that only has a few kilobytes of
RAM. I wonder if the restriction of 32 bytes on the align directive
could just be removed, or will we need some sort of linker script changes?


It could be removed but I'am pretty sure that the linker does not use 
the alignment space for other stuff.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : [fpc-pascal] Variable alignment in arm-embedded

2012-06-12 Thread alrieckert
Hi Jeppe,

I've been using the actual ROM based interrupt table for the past month now
in freepascal ad it seems to work great. No need to declare a block of RAM
and pointing the interrupt table to it.

You can code any procedure and just give it the interrupt keyword with an
address index.

For example:



There are 3 patches you need to apply to your compiler. I'll try to submit
the patches to the Freepascal mailing list and hopefully someone will accept
them, but in the mean time you can find them here.

https://github.com/alrieckert/freepascal/commit/8255677c9a79dfec22b65c5b34be43b1602c6928
https://github.com/alrieckert/freepascal/commit/2e40029a9d4b191ee06b7b3519bdc382769adbc7
https://github.com/alrieckert/freepascal/commit/1883b86791af851f0c5093760e349dc8854c5905

The first patch enables the interrupt keyword for the arm-embedded target
and allows the compiler to generate the NVIT table that will link in at
0x08000

The second patch is a small bug fix with the stm32f103.pp definition file

The third patch fixed the exit code, otherwise you will get Hard Fault
interrupt when a interrupt occurs as a procedure is busy restoring the stack
and SP.

No need to give the nostackframe since the ARMv7m automatically stores
R0-R3, R12, SP and LR for you when  an interrupt occurs, thus the interrupt
procedure looks exactly like a normal procedure.

Please let me know if you have any questions.

--
Anton  

--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Variable-alignment-in-arm-embedded-tp5709962p5709998.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : [fpc-pascal] Variable alignment in arm-embedded

2012-06-12 Thread Koenraad Lelong

On 08-06-12 14:37, Jeppe Græsdal Johansen wrote:

Den 08-06-2012 14:28, Ludo Brands skrev:

Thanks Ludo,

I'll take that as a starting point. I hope I will not need the "lost"
256 bytes in the future.

I could be wrong but AFAIK if the compiler would do the alignment, the
loss
can also be up to 255 bytes. Here you lose 256 bytes in all cases.

Yes, but this would allow the linker to place other stuff there which
fits in less than 255 bytes.

Wasting 255 bytes is a lot on systems that only has a few kilobytes of
RAM. I wonder if the restriction of 32 bytes on the align directive
could just be removed, or will we need some sort of linker script changes?


Hi,

I'm still struggling to get interrupts (or even inputs) work but I 
wanted to comment on the size of the table. Reading the manuals I found 
it's actually on a 512 byte boundery. The VTOR (Vector Table Offset 
Register) masks off the last 9 bits (8..0).
If I need that space I will modify the start of RAM location and use the 
first bytes of RAM for the vector-table.
It would be nice to have "external" linker scripts. That way you could 
more easily add processors, or use custom bootloaders.


Regards,

Koenraad Lelong.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : [fpc-pascal] Variable alignment in arm-embedded

2012-06-08 Thread Jeppe Græsdal Johansen

Den 08-06-2012 14:28, Ludo Brands skrev:

Thanks Ludo,

I'll take that as a starting point. I hope I will not need the "lost"
256 bytes in the future.

I could be wrong but AFAIK if the compiler would do the alignment, the loss
can also be up to 255 bytes. Here you lose 256 bytes in all cases.
Yes, but this would allow the linker to place other stuff there which 
fits in less than 255 bytes.


Wasting 255 bytes is a lot on systems that only has a few kilobytes of 
RAM. I wonder if the restriction of 32 bytes on the align directive 
could just be removed, or will we need some sort of linker script changes?

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal