Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2011-08

Stellaris Update

12 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

John Clymer

So, after some work, I have a compiler working for the LM3S8962 board (a successful Blinking LED :-) )

However, as I was going through some of the various datasheets, I see that all the Stellaris controllers have similar memory maps. That is:

A) Each type of device has a specific spot in the memory map to sit at. B) If a device has less or no device of a given type, that memory map is "Reserved"
C) The SRAM and FLASH memories always start at the same address

As such, I'm leaning towards:

{$FLASH_START xxxxx}
{$FLASH_SIZE xxxxx }
{$SRAM_START xxxxx }
{$SRAM_SIZE xxxxx }

By doing this, only 1 config will work for all stellaris parts (as was originally laid out in the cpuinfo file.)

I'm also looking to do a survey of all STM32 devices to see if a similar situation exists. I think, for all Cortex M3 devices of a particular manufacturer, a similar scheme can be used. The M3 specs make requirements that limit the "flexibility" to come up with oddball memory layouts.

John Clymer

Reply by email

DaWorm
to John Clymer

STM32F103 and other ST Micro M3 parts have the ability to remap the vector table. You can create applications to start anywhere in memory, and use a bootloader to remap the table and jump to the new power up vector. In IAR C this is handled in the linker config file. Someone on the list thought it better not to go that route. However it is done, it should be done at an individual application level, not tied to the part.

Reply by email

Geoffrey Barton
to John Clymer: So, after some work, I have a compiler working for the LM3S8962 board (a successful…
John Clymer wrote 18 lines
So, after some work, I have a compiler working for the LM3S8962 board (a successful Blinking LED :-) ) However, as I was going through some of the various datasheets, I see that all the Stellaris controllers have similar memory maps. That is: A) Each type of device has a specific spot in the memory map to sit at. B) If a device has less or no device of a given type, that memory map is "Reserved" C) The SRAM and FLASH memories always start at the same address As such, I'm leaning towards: {$FLASH_START xxxxx} {$FLASH_SIZE xxxxx } {$SRAM_START xxxxx } {$SRAM_SIZE xxxxx } By doing this, only 1 config will work for all stellaris parts (as was originally laid out in the cpuinfo file.) I'm also looking to do a survey of all STM32 devices to see if a similar situation exists. I think, for all Cortex M3 devices of a particular manufacturer, a similar scheme can be used. The M3 specs make requirements that limit the "flexibility" to come up with oddball memory layouts.

It is clear from the ARM cortex m3 tech ref manual that all derivatives (all manufacturers) have internal code starting at $00000000 and ram starting at $20000000, so only two parameters are required for all possible cortex m3 parts, written either as ram top, flash top, or ram size, flash size.

Geoffrey

Show quoted text 5 lines
John Clymer _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Florian Klämpfl
to John Clymer: So, after some work, I have a compiler working for the LM3S8962 board (a successful…
John Clymer wrote 10 lines
So, after some work, I have a compiler working for the LM3S8962 board (a successful Blinking LED :-) ) However, as I was going through some of the various datasheets, I see that all the Stellaris controllers have similar memory maps. That is: A) Each type of device has a specific spot in the memory map to sit at. B) If a device has less or no device of a given type, that memory map is "Reserved" C) The SRAM and FLASH memories always start at the same address

So why would the directives be needed?

Show quoted text 10 lines
As such, I'm leaning towards: {$FLASH_START xxxxx} {$FLASH_SIZE xxxxx } {$SRAM_START xxxxx } {$SRAM_SIZE xxxxx } By doing this, only 1 config will work for all stellaris parts (as was originally laid out in the cpuinfo file.)

What config? Memory layout in the compiler? Even without the directives mentioned above, mulitple stellaris controllers can share the same memory layout config in t_embedded?

Reply by email

John Clymer
to DaWorm: STM32F103 and other ST Micro M3 parts have the ability to remap the vector table. You…

One of my current "fixes" i have in place allows using the PPCCROSSARM compiler to compile Pascal to Assembly. Once in Assembly, the files can be assembled and linked like any other program. So, you have the capability to do just about an exotic configuration you want - you just have to do so via assembly rather than straight to object code. (If I've missed a way to go directly to an object file from a pascal file - I'd be very happy - I didn't see any command line switches to compile and generate .o files.)

To accommodate the compile to assembly option was only a 2 line change to t_embed.pas.

However, I also agree with the sentiment that the compiler should be downloadable and able to produce a binary for people not accustomed to command lines, makefiles, etc. To that end, and to 90% of most conceivable cases, the {$FLASH_START}, etc [with some sane defaults] mechanism provides enough power to accommodate most of the compilers potential users.

John

________________________________

Earlier message 12 lines
From: DaWorm To: FPC developers' list Sent: Tue, August 16, 2011 8:49:51 AM Subject: Re: [fpc-devel] Stellaris Update STM32F103 and other ST Micro M3 parts have the ability to remap the vector table. You can create applications to start anywhere in memory, and use a bootloader to remap the table and jump to the new power up vector. In IAR C this is handled in the linker config file. Someone on the list thought it better not to go that route. However it is done, it should be done at an individual application level, not tied to the part.

Reply by email

John Clymer
to Florian Klämpfl: So why would the directives be needed? What config? Memory layout in the compiler? Even…

Stellaris ALWAYS has the Code starting at $0000:0000.

STM32's do something odd where the FLASH starts at $0800:0000, and the memory between $0000:0000 and $07FF:FFFF is mappable to either the FLASH or the built-in boot loader. (Which throws a kink in the works.)

But, as far as the point of catching the 90% of possible uses - one could drop down to strictly {$FLASH_SIZE} and {$SRAM_SIZE}.

The other option (unless one wants a gazzillion items on the case() statements in t_embed.pas) - is to set them extremely large so they don't get exceeded. However, the danger in that is if someone has an 8K part, and the program ends up spilling over 8K - it won't get picked up.

Also started un-commenting some parts of rtl.cfg in the embedded folder. Is there any desire to support more of the RTL than the minimum (i.e. have a default stdin and stdout - so WriteLn, etc work via the serial port ?) Or is the intent that embedded includes on the bare minimal RTL to bring the machine up ?

Thanks,

John

________________________________

Earlier message 33 lines
From: Florian Klämpfl To: FPC developers' list Sent: Tue, August 16, 2011 12:35:03 PM Subject: Re: [fpc-devel] Stellaris Update Am 16.08.2011 05:39, schrieb John Clymer: > So, after some work, I have a compiler working for the LM3S8962 board (a > successful Blinking LED :-) ) > > However, as I was going through some of the various datasheets, I see > that all the Stellaris controllers have similar memory maps. That is: > > A) Each type of device has a specific spot in the memory map to sit at. > B) If a device has less or no device of a given type, that memory map is > "Reserved" > C) The SRAM and FLASH memories always start at the same address So why would the directives be needed? > > As such, I'm leaning towards: > > {$FLASH_START xxxxx} > {$FLASH_SIZE xxxxx } > {$SRAM_START xxxxx } > {$SRAM_SIZE xxxxx } > > By doing this, only 1 config will work for all stellaris parts (as was > originally laid out in the cpuinfo file.) What config? Memory layout in the compiler? Even without the directives mentioned above, mulitple stellaris controllers can share the same memory layout config in t_embedded?

Reply by email

John Clymer
to Florian Klämpfl: So why would the directives be needed? What config? Memory layout in the compiler? Even…

Sorry, missed the second set of questions....

I was able to get the stellaris part setup in t_embed.pas and cpuinfo.pas, then I got build errors when I build an executable - it was missing the Controller's startup file - these are in rtl\embedded\arm. Once FPC finishes compiling the program, it wants to link with a unit with the same name as the Controller. So, if each controller gets supported separately, then that folder is going to be chock full of controller specific startup files - most of which will be duplicates inside the same family.

Unless I'm missing something, in order to get a binary for the LM3S8962, using that specific controller as the target, I had to have a file in that folder with that same name - and with the unit inside named the same as the microcontroller.

John

________________________________

Earlier message 34 lines
From: Florian Klämpfl To: FPC developers' list Sent: Tue, August 16, 2011 12:35:03 PM Subject: Re: [fpc-devel] Stellaris Update Am 16.08.2011 05:39, schrieb John Clymer: > So, after some work, I have a compiler working for the LM3S8962 board (a > successful Blinking LED :-) ) > > However, as I was going through some of the various datasheets, I see > that all the Stellaris controllers have similar memory maps. That is: > > A) Each type of device has a specific spot in the memory map to sit at. > B) If a device has less or no device of a given type, that memory map is > "Reserved" > C) The SRAM and FLASH memories always start at the same address So why would the directives be needed? > > As such, I'm leaning towards: > > {$FLASH_START xxxxx} > {$FLASH_SIZE xxxxx } > {$SRAM_START xxxxx } > {$SRAM_SIZE xxxxx } > > By doing this, only 1 config will work for all stellaris parts (as was > originally laid out in the cpuinfo file.) What config? Memory layout in the compiler? Even without the directives mentioned above, mulitple stellaris controllers can share the same memory layout config in t_embedded?

Reply by email

Geoffrey Barton
to John Clymer: Stellaris ALWAYS has the Code starting at $0000:0000. STM32's do something odd where the…
John Clymer wrote 9 lines
Stellaris ALWAYS has the Code starting at $0000:0000. STM32's do something odd where the FLASH starts at $0800:0000, and the memory between $0000:0000 and $07FF:FFFF is mappable to either the FLASH or the built-in boot loader. (Which throws a kink in the works.) But, as far as the point of catching the 90% of possible uses - one could drop down to strictly {$FLASH_SIZE} and {$SRAM_SIZE}. The other option (unless one wants a gazzillion items on the case() statements in t_embed.pas) - is to set them extremely large so they don't get exceeded. However, the danger in that is if someone has an 8K part, and the program ends up spilling over 8K - it won't get picked up. Also started un-commenting some parts of rtl.cfg in the embedded folder. Is there any desire to support more of the RTL than the minimum (i.e. have a default stdin and stdout - so WriteLn, etc work via the serial port ?) Or is the intent that embedded includes on the bare minimal RTL to bring the machine up ?

In my case I was trying for the bare minimum, particularly as some of the Stellaris parts have masked ROM ('Stellarisware') containing useful drivers for various functions including USB and ethernet and these are easily called from FPC. This saves flash code space.

Geoffrey

Show quoted text 45 lines
Thanks, John From: Florian Klämpfl To: FPC developers' list Sent: Tue, August 16, 2011 12:35:03 PM Subject: Re: [fpc-devel] Stellaris Update Am 16.08.2011 05:39, schrieb John Clymer: > So, after some work, I have a compiler working for the LM3S8962 board (a > successful Blinking LED :-) ) > > However, as I was going through some of the various datasheets, I see > that all the Stellaris controllers have similar memory maps. That is: > > A) Each type of device has a specific spot in the memory map to sit at. > B) If a device has less or no device of a given type, that memory map is > "Reserved" > C) The SRAM and FLASH memories always start at the same address So why would the directives be needed? > > As such, I'm leaning towards: > > {$FLASH_START xxxxx} > {$FLASH_SIZE xxxxx } > {$SRAM_START xxxxx } > {$SRAM_SIZE xxxxx } > > By doing this, only 1 config will work for all stellaris parts (as was > originally laid out in the cpuinfo file.) What config? Memory layout in the compiler? Even without the directives mentioned above, mulitple stellaris controllers can share the same memory layout config in t_embedded? _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Florian Klämpfl
to John Clymer: Stellaris ALWAYS has the Code starting at $0000:0000. STM32's do something odd where the…
John Clymer wrote 11 lines
Stellaris ALWAYS has the Code starting at $0000:0000. STM32's do something odd where the FLASH starts at $0800:0000, and the memory between $0000:0000 and $07FF:FFFF is mappable to either the FLASH or the built-in boot loader. (Which throws a kink in the works.) But, as far as the point of catching the 90% of possible uses - one could drop down to strictly {$FLASH_SIZE} and {$SRAM_SIZE}. The other option (unless one wants a gazzillion items on the case() statements in t_embed.pas)

Better than some wrecked programs because somebody put a wrong FLASH_SIZE/SRAM_SIZE somewhere. Pascal tries to prevent the user to shoot himself into the foot. *_SIZE /*_START is a good possibility to shoot oneself into the foot while if it is once put into the compiler, it just works.

Reply by email

Florian Klämpfl
to John Clymer: Sorry, missed the second set of questions.... I was able to get the stellaris part setup…
John Clymer wrote 10 lines
Sorry, missed the second set of questions.... I was able to get the stellaris part setup in t_embed.pas and cpuinfo.pas, then I got build errors when I build an executable - it was missing the Controller's startup file - these are in rtl\embedded\arm. Once FPC finishes compiling the program, it wants to link with a unit with the same name as the Controller. So, if each controller gets supported separately, then that folder is going to be chock full of controller specific startup files - most of which will be duplicates inside the same family.

This files are needed anyways to provide the declartions for hardware access. Common declarations/startup code can be easily placed in commonly used include files, and, see below.

Show quoted text 5 lines
Unless I'm missing something, in order to get a binary for the LM3S8962, using that specific controller as the target, I had to have a file in that folder with that same name - and with the unit inside named the same as the microcontroller.

This could be changed in the compiler, this is why we have controllerunitstr and it proved to work well for me when working with LPCs.

Reply by email

Florian Klämpfl
to John Clymer: Stellaris ALWAYS has the Code starting at $0000:0000. STM32's do something odd where the…
John Clymer wrote 19 lines
Stellaris ALWAYS has the Code starting at $0000:0000. STM32's do something odd where the FLASH starts at $0800:0000, and the memory between $0000:0000 and $07FF:FFFF is mappable to either the FLASH or the built-in boot loader. (Which throws a kink in the works.) But, as far as the point of catching the 90% of possible uses - one could drop down to strictly {$FLASH_SIZE} and {$SRAM_SIZE}. The other option (unless one wants a gazzillion items on the case() statements in t_embed.pas) - is to set them extremely large so they don't get exceeded. However, the danger in that is if someone has an 8K part, and the program ends up spilling over 8K - it won't get picked up. Also started un-commenting some parts of rtl.cfg in the embedded folder. Is there any desire to support more of the RTL than the minimum (i.e. have a default stdin and stdout - so WriteLn, etc work via the serial port ?) Or is the intent that embedded includes on the bare minimal RTL to bring the machine up ?

The idea is to have a minimum default. Users needing more can uncomment the needed parts and recompile the rtl.

Reply by email

John Clymer
to Florian Klämpfl: This files are needed anyways to provide the declartions for hardware access. Common…

I was missing something then ! Thanks. (It's usually the obvious things - staring me right in the face - that I miss)

Given that one controller unit file can be re-used amongst multiple controllers, that leaves a giant case() statement - which I can live with.

And, there is a 2 line patch to allow the compiler to compile to assembly - then use binutils to assemble and patch. This gives the flexibility to accommodate non-standard setups.

Expecting to provide a patch set in about a week to include a huge number of stellaris parts support.

John

________________________________

Earlier message 29 lines
From: Florian Klämpfl To: FPC developers' list Sent: Tue, August 16, 2011 2:46:06 PM Subject: Re: [fpc-devel] Stellaris Update Am 16.08.2011 12:24, schrieb John Clymer: > Sorry, missed the second set of questions.... > > I was able to get the stellaris part setup in t_embed.pas and > cpuinfo.pas, then I got build errors when I build an executable - it was > missing the Controller's startup file - these are in rtl\embedded\arm. > Once FPC finishes compiling the program, it wants to link with a unit > with the same name as the Controller. So, if each controller gets > supported separately, then that folder is going to be chock full of > controller specific startup files - most of which will be duplicates > inside the same family. This files are needed anyways to provide the declartions for hardware access. Common declarations/startup code can be easily placed in commonly used include files, and, see below. > > Unless I'm missing something, in order to get a binary for the LM3S8962, > using that specific controller as the target, I had to have a file in > that folder with that same name - and with the unit inside named the > same as the microcontroller. This could be changed in the compiler, this is why we have controllerunitstr and it proved to work well for me when working with LPCs.

Reply by email