Sign in Join

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

Mailing lists / fpc-devel / 2014-11

Option -Wp does not work with new embedded target

8 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

Sietse Achterop

Hello,
I'm trying to create a version of fpc that generates code for the stm32f4xx arm processor from STM. If done everything mentioned on
http://wiki.freepascal.org/TARGET_Embedded
I have called t
and now have a first version of an RTL for that target, created the compiler and tried a first program doing ppcrossarm -Ch1024 -Cs1024 -Tembedded -Parm -Cparmv7m -XParm-none-eabi- -Wpstm32f4xx prog.p But the error is:
Error: Illegal parameter: -Wpstm32f4xx

I assumed that the new target would be known after changing compiler/arm/cpuinfo.pas, but it obviously didn't.

Is there something else to be done apart from that on the website?

Thanks in advance,
Sietse

Reply by email

Florian Klämpfl
to Sietse Achterop
Sietse Achterop wrote 15 lines
Hello, I'm trying to create a version of fpc that generates code for the stm32f4xx arm processor from STM. If done everything mentioned on http://wiki.freepascal.org/TARGET_Embedded I have called t and now have a first version of an RTL for that target, created the compiler and tried a first program doing ppcrossarm -Ch1024 -Cs1024 -Tembedded -Parm -Cparmv7m -XParm-none-eabi- -Wpstm32f4xx prog.p But the error is: Error: Illegal parameter: -Wpstm32f4xx I assumed that the new target would be known after changing compiler/arm/cpuinfo.pas, but it obviously didn't. Is there something else to be done apart from that on the website?

Please post your patch somewhere, guessing without knowing the changes is hard.

Reply by email

Michael Ring
to Sietse Achterop: I'm trying to create a version of fpc that generates code for the stm32f4xx arm processor…

You need to change two files,

+++ compiler/arm/cpuinfo.pas (working copy)
+++ compiler/systems/t_embed.pas (working copy)

I have already done that work, I can send you a patchfile for trunk that adds the following devices:

STM32F401CB
STM32F401RB,STM32F401VB,STM32F401CC,STM32F401RC,STM32F401VC,STM32F401CD STM32F401RD,STM32F401VD,STM32F401CE,STM32F401RE,STM32F401VE,STM32F405RG STM32F405VG,STM32F405ZG,STM32F405OG,STM32F405OE,STM32F407VG,STM32F407IG STM32F407ZG,STM32F407VE,STM32F407ZE,STM32F407IE,STM32F415RG,STM32F415VG STM32F415ZG,STM32F415OG,STM32F417VG,STM32F417IG,STM32F417ZG,STM32F417VE STM32F417ZE,STM32F417IE,STM32F427VG,STM32F427ZG,STM32F427IG,STM32F427VI STM32F427ZI,STM32F427II,STM32F429VG,STM32F429ZG,STM32F429IG,STM32F429VI STM32F429ZI,STM32F429II,STM32F429BG,STM32F429BI,STM32F429NI,STM32F429NG STM32F437VG,STM32F437ZG,STM32F437IG,STM32F437VI,STM32F437ZI,STM32F437II STM32F439VI,STM32F439VG,STM32F439ZG,STM32F439ZI,STM32F439IG,STM32F439II STM32F439BG,STM32F439BI,STM32F439NI,STM32F439NG

Sietse Achterop wrote 26 lines
Hello, I'm trying to create a version of fpc that generates code for the stm32f4xx arm processor from STM. If done everything mentioned on http://wiki.freepascal.org/TARGET_Embedded I have called t and now have a first version of an RTL for that target, created the compiler and tried a first program doing ppcrossarm -Ch1024 -Cs1024 -Tembedded -Parm -Cparmv7m -XParm-none-eabi- -Wpstm32f4xx prog.p But the error is: Error: Illegal parameter: -Wpstm32f4xx I assumed that the new target would be known after changing compiler/arm/cpuinfo.pas, but it obviously didn't. Is there something else to be done apart from that on the website? Thanks in advance, Sietse _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Sietse Achterop
to Michael Ring
Michael Ring wrote
You need to change two files, +++ compiler/arm/cpuinfo.pas (working copy) +++ compiler/systems/t_embed.pas (working copy)

Thanks Florian van Michael,

You can find the files I changed on
http://fwn06.housing.rug.nl/fpc-stm32f4
There you find the above files, the Makefile.fpc from rtl/embedded and the new files in rtl/embedded/arm.

The diff from cpuinfo.pas with current trunk is:

*** tmp/fpc/compiler/arm/cpuinfo.pas 2014-11-30 11:59:12.008103356 +0100 --- fpc/compiler/arm/cpuinfo.pas 2014-11-30 11:51:10.332117439 +0100 ***************
*** 249,254 ****
--- 249,255 ----
ct_stm32f107rc,
ct_stm32f107vb,
ct_stm32f107vc,
+ ct_stm32f4xx, // use this name for the moment

{ TI - Fury Class - 64 K Flash, 16 K SRAM Devices } ct_lm3s1110,
***************
*** 617,622 ****
--- 618,627 ----
(controllertypestr:'STM32F107VB'; controllerunitstr:'STM32F10X_CL'; flashbase:$08000000; flashsize:$00020000; srambase:$20000000; sramsize:$00010000), (controllertypestr:'STM32F107VC'; controllerunitstr:'STM32F10X_CL'; flashbase:$08000000; flashsize:$00040000; srambase:$20000000; sramsize:$00010000),

+ { STM32F4 series }
+ (controllertypestr:'STM32F4xx'; controllerunitstr:'STM32F4xx'; flashbase:$08000000; flashsize:$00100000; srambase:$20000000; sramsize:$00010000),
+ { How to include CCMRAM? : ORIGIN = 0x10000000, LENGTH = 64K } +
(controllertypestr:'LM3S1110'; controllerunitstr:'LM3FURY'; flashbase:$00000000; flashsize:$00010000; srambase:$20000000; sramsize:$00004000), (controllertypestr:'LM3S1133'; controllerunitstr:'LM3FURY'; flashbase:$00000000; flashsize:$00010000; srambase:$20000000; sramsize:$00004000), (controllertypestr:'LM3S1138'; controllerunitstr:'LM3FURY'; flashbase:$00000000; flashsize:$00010000; srambase:$20000000; sramsize:$00004000),

Looks alright to me.
The diff from t_embed.pas is:

*** tmp/fpc/compiler/systems/t_embed.pas 2014-11-30 11:59:12.172103351 +0100 --- fpc/compiler/systems/t_embed.pas 2014-11-30 11:37:14.796141869 +0100 ***************
*** 401,406 ****
--- 401,407 ----
ct_stm32f107rc,
ct_stm32f107vb,
ct_stm32f107vc,
+ ct_stm32f4xx,

{ TI - 64 K Flash, 16 K SRAM Devices }
ct_lm3s1110,

Also ok?
I think the error has to come from one of these files, not the contents of the rtl itself. The rtl code is still rather rough, but it compiles.

I have already done that work, I can send you a patchfile for trunk that adds the following devices:

That would be nice,

Thanks,
Sietse

Reply by email

Michael Ring
to Sietse Achterop

Please download my diff here:

http://temp.michael-ring.org/fpc-arm.diff

I could not really find a difference in what you are doing to what I am doing so perhaps I give you my commandlines for the build, perhaps the difference is in the way you build:

Build&Install the compiler (in Cortex-M3 Mode)
make clean buildbase CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm *SUBARCH=armv7m* CROSSOPT="-O- -gw2" BINUTILSPREFIX=arm-none-eabi- || exit 1 sudo make installbase CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv7m CROSSOPT="-O-" BINUTILSPREFIX=arm-none-eabi- || exit 1

Build&Install the compiler (in Cortex-M4 Mode)
make clean buildbase CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm *SUBARCH=armv7em* CROSSOPT="-O- -gw2" BINUTILSPREFIX=arm-none-eabi- || exit 1
sudo make installbase CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv7em CROSSOPT="-O-" BINUTILSPREFIX=arm-none-eabi- || exit 1

This gives me a compiler that works for compiling:

/usr/local/lib/fpc/2.7.1/ppcrossarm -MObjFPC -Scghi -al -Ch1024 -Cs1024 -Tembedded -Parm -gw2 -godwarfsets -godwarfmethodclassprefix -vewnhixv -l -Cparmv7m *-WpSTM32F407VG* -XParm-none-eabi- -FD/usr/local/bin -a peephole.pas

I usually compile for Cortex-M4 in Cortex-M3 Mode, this makes life a little easier when you do not need the features of armv7em.

The reason for this is that currently fpc cannot distinguish between different subarchs and I do not want to have several installations of ppcrossarm on my machine as long as I do not need the special armv7em features.

Please have a look at the rtl-files I provide (and tell me if you like the way I created them) , they are automagically created out of the CMSIS sources provided by ARM&ST.

Michael

Sietse Achterop wrote 94 lines
On 11/30/2014 11:55 AM, Michael Ring wrote: > You need to change two files, > > +++ compiler/arm/cpuinfo.pas (working copy) > +++ compiler/systems/t_embed.pas (working copy) Thanks Florian van Michael, You can find the files I changed on http://fwn06.housing.rug.nl/fpc-stm32f4 There you find the above files, the Makefile.fpc from rtl/embedded and the new files in rtl/embedded/arm. The diff from cpuinfo.pas with current trunk is: *** tmp/fpc/compiler/arm/cpuinfo.pas 2014-11-30 11:59:12.008103356 +0100 --- fpc/compiler/arm/cpuinfo.pas 2014-11-30 11:51:10.332117439 +0100 *************** *** 249,254 **** --- 249,255 ---- ct_stm32f107rc, ct_stm32f107vb, ct_stm32f107vc, + ct_stm32f4xx, // use this name for the moment { TI - Fury Class - 64 K Flash, 16 K SRAM Devices } ct_lm3s1110, *************** *** 617,622 **** --- 618,627 ---- (controllertypestr:'STM32F107VB'; controllerunitstr:'STM32F10X_CL'; flashbase:$08000000; flashsize:$00020000; srambase:$20000000; sramsize:$00010000), (controllertypestr:'STM32F107VC'; controllerunitstr:'STM32F10X_CL'; flashbase:$08000000; flashsize:$00040000; srambase:$20000000; sramsize:$00010000), + { STM32F4 series } + (controllertypestr:'STM32F4xx'; controllerunitstr:'STM32F4xx'; flashbase:$08000000; flashsize:$00100000; srambase:$20000000; sramsize:$00010000), + { How to include CCMRAM? : ORIGIN = 0x10000000, LENGTH = 64K } + (controllertypestr:'LM3S1110'; controllerunitstr:'LM3FURY'; flashbase:$00000000; flashsize:$00010000; srambase:$20000000; sramsize:$00004000), (controllertypestr:'LM3S1133'; controllerunitstr:'LM3FURY'; flashbase:$00000000; flashsize:$00010000; srambase:$20000000; sramsize:$00004000), (controllertypestr:'LM3S1138'; controllerunitstr:'LM3FURY'; flashbase:$00000000; flashsize:$00010000; srambase:$20000000; sramsize:$00004000), Looks alright to me. The diff from t_embed.pas is: *** tmp/fpc/compiler/systems/t_embed.pas 2014-11-30 11:59:12.172103351 +0100 --- fpc/compiler/systems/t_embed.pas 2014-11-30 11:37:14.796141869 +0100 *************** *** 401,406 **** --- 401,407 ---- ct_stm32f107rc, ct_stm32f107vb, ct_stm32f107vc, + ct_stm32f4xx, { TI - 64 K Flash, 16 K SRAM Devices } ct_lm3s1110, Also ok? I think the error has to come from one of these files, not the contents of the rtl itself. The rtl code is still rather rough, but it compiles. > > I have already done that work, I can send you a patchfile for trunk > that adds the following devices: > That would be nice, Thanks, Sietse _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Florian Klämpfl
to Sietse Achterop: You can find the files I changed on http://fwn06.housing.rug.nl/fpc-stm32f4 There you…
Sietse Achterop wrote 38 lines
On 11/30/2014 11:55 AM, Michael Ring wrote: > You need to change two files, > > +++ compiler/arm/cpuinfo.pas (working copy) > +++ compiler/systems/t_embed.pas (working copy) Thanks Florian van Michael, You can find the files I changed on http://fwn06.housing.rug.nl/fpc-stm32f4 There you find the above files, the Makefile.fpc from rtl/embedded and the new files in rtl/embedded/arm. The diff from cpuinfo.pas with current trunk is: *** tmp/fpc/compiler/arm/cpuinfo.pas 2014-11-30 11:59:12.008103356 +0100 --- fpc/compiler/arm/cpuinfo.pas 2014-11-30 11:51:10.332117439 +0100 *************** *** 249,254 **** --- 249,255 ---- ct_stm32f107rc, ct_stm32f107vb, ct_stm32f107vc, + ct_stm32f4xx, // use this name for the moment { TI - Fury Class - 64 K Flash, 16 K SRAM Devices } ct_lm3s1110, *************** *** 617,622 **** --- 618,627 ---- (controllertypestr:'STM32F107VB'; controllerunitstr:'STM32F10X_CL'; flashbase:$08000000; flashsize:$00020000; srambase:$20000000; sramsize:$00010000), (controllertypestr:'STM32F107VC'; controllerunitstr:'STM32F10X_CL'; flashbase:$08000000; flashsize:$00040000; srambase:$20000000; sramsize:$00010000), + { STM32F4 series } + (controllertypestr:'STM32F4xx'; controllerunitstr:'STM32F4xx'; flashbase:$08000000;

This will fail since the -Wpxxx parameter is upper cased before comparison.

Reply by email

Sietse Achterop
to Michael Ring: Please download my diff here: http://temp.michael-ring.org/fpc-arm.diff I could not…

Hello list,

@Florian: thanks for finding my error. I saw that something was case insensitive, but not in this way(: it now works!

@Michael:

Michael Ring wrote 6 lines
Please download my diff here: http://temp.michael-ring.org/fpc-arm.diff Please have a look at the rtl-files I provide (and tell me if you like the way I created them) , they are automagically created out of the CMSIS sources provided by ARM&ST.

I had a short looks clean.
But I am curious, how did you create them. I also started from the source from ARM&ST. I used programs that I found on the Internet like h2pas, en 2 versions of c2pas. But they only partly did the job, so there still was quit some handwork needed to get it to compile. And it still needs a lot of cleaning up.
If I have it properly working, I want to make the ST-libraries for the standard I/O and USB available. I think I will not try to translate it into Pascal, but directly use the ST-libraries from C.
(I use STM32_USB-Host-Device_Lib_V2.1.0)

I'll keep you informed.
Sietse

Reply by email

Michael Ring
to Sietse Achterop

you can find a lot of information on CMSIS here:

http://www.arm.com/products/processors/cortex-m/cortex-microcontroller-software-interface-standard.php

To download the svd-files you need to create a free account @arm.com, then you can download lots of svd files for all major chips.

It is even easier when you have a license for the keil ide, they provide a tool that makes downloading the files even easier (and sometimes files are a little more up-to-date)

My first attempt was to convert the .h files to .pp (I still have some programs to do that), the problem there is that sometimes the header files are incomplete, the definitions for the bits in the registers is often missing.

The .svd files are xml files that are quite easy to parse and they usually contain all the information on the bit level. And the nice thing is that no cleanup is necessary ;-)

Michael

Sietse Achterop wrote 39 lines
Hello list, @Florian: thanks for finding my error. I saw that something was case insensitive, but not in this way(: it now works! @Michael: On 11/30/2014 08:14 PM, Michael Ring wrote: > Please download my diff here: > > http://temp.michael-ring.org/fpc-arm.diff > > Please have a look at the rtl-files I provide (and tell me if you > like the way I created them) , they are automagically created out of > the CMSIS sources provided by ARM&ST. > I had a short looks clean. But I am curious, how did you create them. I also started from the source from ARM&ST. I used programs that I found on the Internet like h2pas, en 2 versions of c2pas. But they only partly did the job, so there still was quit some handwork needed to get it to compile. And it still needs a lot of cleaning up. If I have it properly working, I want to make the ST-libraries for the standard I/O and USB available. I think I will not try to translate it into Pascal, but directly use the ST-libraries from C. (I use STM32_USB-Host-Device_Lib_V2.1.0) I'll keep you informed. Sietse _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email