Recent

Author Topic: [FPC, CROSS ARM] for LPC1114  (Read 2632 times)

devport

  • New Member
  • *
  • Posts: 26
[FPC, CROSS ARM] for LPC1114
« on: October 29, 2019, 09:43:00 pm »
Hey i compile simple code for my LPC1114.
I have questions:

1. i can use ObjFPC mode ?
2. If use SetLenght my program stoped why?
3. I muset settings heap size? 

Please help.

Sorry, my english is not perfet :) I from Poland.
Thx


Laksen

  • Hero Member
  • *****
  • Posts: 724
    • J-Software
Re: [FPC, CROSS ARM] for LPC1114
« Reply #1 on: October 29, 2019, 10:31:14 pm »
1. Yes, but as you have found out you need to ensure that you are aware of your memory usage
2. Because you need to install a memory manager explicitly. You can do that by adding "heapmgr" to your uses list as one of the first units. Then you need to set the heap size as in your third question
3. Setting the heap size only does something if you use the heap area. The heapmgr unit does that, for example. So if you set heap size (command line option -Ch) and use heapmgr you should see you should be able to allocate dynamic memory

devport

  • New Member
  • *
  • Posts: 26
Re: [FPC, CROSS ARM] for LPC1114
« Reply #2 on: October 30, 2019, 08:42:07 am »
Thank you

I like Pascal Dialect and last 6 years programmed in C...
Does it make sense to write in this language? on embedded devices?
More as a hobby codding :P

Laksen

  • Hero Member
  • *****
  • Posts: 724
    • J-Software
Re: [FPC, CROSS ARM] for LPC1114
« Reply #3 on: October 30, 2019, 09:20:21 am »
Definitely :)

lvaskov

  • Newbie
  • Posts: 3
Re: [FPC, CROSS ARM] for LPC1114
« Reply #4 on: November 23, 2019, 02:52:29 pm »
Hi, I am trying to do exactly as you wrote here - set heap size and add heapmgr unit to uses clause. But on compilation it gives an error:
Cannot find heapmgr used by ...

My Target OS is Linux, target CPU is arm. Should I add some more paths to the project options? The heapmgr unit is found only in fpc\fpcsrc\rtl\embeded directory and if I add it to the path, then a lot more errors start to emerge.

Laksen

  • Hero Member
  • *****
  • Posts: 724
    • J-Software
Re: [FPC, CROSS ARM] for LPC1114
« Reply #5 on: November 23, 2019, 08:52:36 pm »
What options did you use?

lvaskov

  • Newbie
  • Posts: 3
Re: [FPC, CROSS ARM] for LPC1114
« Reply #6 on: November 23, 2019, 09:10:48 pm »
These are the options as reported by Lazarus (excluding some project specific paths):

C:\FreePascal\fpc\bin\x86_64-win64\fpc.exe
-Tlinux
-Parm
-CpARMV7A
-MDelphi
-Scaghi
-CirotR
-Ch33554432
-O1
-gw2
-godwarfsets
-gl
-Xg
-gt
-vewnhibq
-Fi..\..\Binary\Linux32ARM\Debug\Units
-FuC:\FreePascal\lazarus\lcl\units\arm-linux\gtk2
-FuC:\FreePascal\lazarus\lcl\units\arm-linux
-FuC:\FreePascal\lazarus\components\lazutils\lib\arm-linux
-FuC:\FreePascal\lazarus\packager\units\arm-linux
-Fu.
-FU..\..\Binary\Linux32ARM\Debug\Units
-FE..\..\Binary\Linux32ARM\Debug
-o..\..\Binary\Linux32ARM\Debug\Project
-dLCL
-dLCLgtk2

Lazarus manages to find and open the file when I Control+Click on it, so it must be something with the compiler.

I tried to copy heapmgr.pp to my project's directory and add it to the project but when it is compiled it gives an error:
Code: Pascal  [Select][+][-]
  1. heapmgr.pp(288,38) Fatal: Syntax error, ":" expected but "identifier NAME" found

at this section:
Code: Pascal  [Select][+][-]
  1. var
  2.   initialheap : record end; external name '__fpc_initialheap';
  3.   heapsize : PtrInt; external name '__heapsize';
« Last Edit: November 23, 2019, 09:25:36 pm by lvaskov »

lvaskov

  • Newbie
  • Posts: 3
Re: [FPC, CROSS ARM] for LPC1114
« Reply #7 on: November 23, 2019, 11:22:47 pm »
Further tries:
Since the project is marked as {$MODE DELPHI}, looks like it prevents heapmgr from compiling, as mentioned in the previous comment. I put a {$MODE OBJFPC} in the beginning of it and the project compiled . But next another error follows:

Code: Pascal  [Select][+][-]
  1. (9015) Linking C:\FreePascal\Projects\Test\Binary\Linux32ARM\Debug\Project
  2. C:\FreePascal\Projects\Test\Binary\Linux32ARM\Debug\Units\heapmgr.o: In function `HEAPMGR_$$_init$':
  3. C:/FreePascal/Projects/Test/Packages/Application//heapmgr.pp:289: undefined reference to `__fpc_initialheap'
  4. C:\FreePascal\Projects\Test\Packages\Application\Project.lpr(40,1) Error: (9013) Error while linking
  5. C:\FreePascal\Projects\Test\Packages\Application\Project.lpr(40,1) Fatal: (10026) There were 1 errors compiling module, stopping
  6. Fatal: (1018) Compilation aborted
  7. Error: C:\FreePascal\fpc\bin\x86_64-win64\ppcrossarm.exe returned an error exitcode

 

TinyPortal © 2005-2018