Forum > Embedded
Running a minimal fpc on a microcontroller
ccrause:
A tough challenge. Some ideas:
* remove compiler messages and help (~ 80kB)
* drop debug info support (this will probably shave off a few kB)
* remove unicode support in compiler[\li]
* remove multiple dialect support (macpas/fpc/delphi/objfpc/iso) and only support a single dialect (probably complicated, I think these dialect checks are sprinkled over several units)I'll speculate that this will drop the compiler size closer to 2 MB in size.
In embedded you have to provide build-in file system support of some kind and memory management. At least there is a lightweight heap manager in RTL. Then (as marcov mentioned) you need binutlis such an assembler and linker. Not sure this is available, so one may have to include an embedded linker in the compiler.
jwdietrich:
--- Quote from: mischi on May 28, 2019, 01:47:00 pm ---If you could get along with old style iso pascal without objects, the p5 pascal compiler might do a job.
--- End quote ---
A p5 compiler that can be compiled by FPC is available from https://github.com/tangentstorm/pascal/tree/master/p5.
Edson:
8 MB RAM is too small for modern compilers. Maybe it's better to use some other small Pascal compilers or create one new. It will depends on what features you want to support in the compiler. OOP compilers are complex but classic Pascal compilers are smaller.
marcov:
(I can remember my first attempt at porting pre 1.0 FPC to FreeBSD. The year was 1998, and the idea was to just make cycle with a target linux, but then on a FreeBSD system). The non production FreeBSD system was an old 486 with 8MB, and a 32MB swap.
After 6 hours compiling it bombed out with a linking error, sigh. Slow porting it is :)
avra:
I knew I would find it in the end. You can take a look for inspiration at this a p-code Pascal running on AVR MEGA163:
https://community.atmel.com/projects/pchip
You might also examine these p-code related links:
https://gist.github.com/r-lyeh-archived/0af42b2788bb75219061
https://www.slideshare.net/Sandeep_Rv/p-code
http://www.textfiles.com/bitsavers/pdf/stanford/sel_techReports/TN164_A_Pascal_P-Code_Interpreter_for_the_Stanford_Emmy_Sep79.pdf
https://homepages.cwi.nl/~steven/pascal/
https://scara.com/~schirmer/o/pcodevm/
https://en.wikipedia.org/wiki/P-code_machine
Navigation
[0] Message Index
[#] Next page
[*] Previous page