Recent

Author Topic: Raspberry Pi Pico and Freepascal  (Read 3533 times)

MiR

  • Full Member
  • ***
  • Posts: 201
Re: Raspberry Pi Pico and Freepascal
« Reply #15 on: January 31, 2021, 06:06:08 pm »
I have now pushed latest changes to my freepascal repository, so far things look good, I can run code through the debugger and can also simply drag & drop the generated uf2 binary to my pico when I am in bootloader mode.

GPIO and UART work, time to clean up everything and to wait for first feedback....

Those initial steps were easier than I thought, not too many roadblocks in the way.

Has anybode else beside me already bought a pico?

Michael

ccrause

  • Sr. Member
  • ****
  • Posts: 363
Re: Raspberry Pi Pico and Freepascal
« Reply #16 on: January 31, 2021, 06:17:44 pm »
Has anybode else beside me already bought a pico?
Not yet, I'm still trying to understand 8 bit AVRs. And ESPs. So much to learn, so little time :o

MiR

  • Full Member
  • ***
  • Posts: 201
Re: Raspberry Pi Pico and Freepascal
« Reply #17 on: January 31, 2021, 07:21:14 pm »
I like it that there are now cheap chips/boards with more Ram and Flash, before the pico showed up i played arround with the Seeduino Xiao and the WIO Terminal (well, mostly Alfred has done quite some magic with that board), not always running out of RAM is such a nice experience....

petex

  • Jr. Member
  • **
  • Posts: 69
Re: Raspberry Pi Pico and Freepascal
« Reply #18 on: February 01, 2021, 08:43:25 pm »
Quote
Has anybode else beside me already bought a pico?

Yes, I got one Saturday. Still working on evaluating the STM32 card. It looks more powerful than the STM32 at roughly the same price. The sites selling the PICO in the UK seem to be rationing them at the moment. I will be keen to get working on it soon as possible.

Are my efforts on getting the Pi debugger interface to work on the STM32 transferable to the Pico ?

I am especially interested in the analog conversion side for a project I am looking at. I may be wrong but are less analog channels available on the Pico ?. There are 8 on the STM blue pill card.

MiR

  • Full Member
  • ***
  • Posts: 201
Re: Raspberry Pi Pico and Freepascal
« Reply #19 on: February 01, 2021, 09:31:21 pm »
The pico only has 3 anolog inputs, what do you plan to do with analog?

You can use your raspberry pi to debug the pico, in the getting started document are explanations how to build a special version of openocd needed for the pico.

Using a second pico is easier but when you say devices get rationed then the raspi will do.

Debuging the pico in lazarus works the same as debugging the stm32.

turronet

  • New Member
  • *
  • Posts: 15
Re: Raspberry Pi Pico and Freepascal
« Reply #20 on: February 13, 2021, 02:11:49 pm »
First of all, areally big Thank You MiR for Your effort on supporting the pico.
I received mine and I immediately look for the fpc way, so I'm here.
As a noob I ordered 1 pico only, so I'll buy the debugger soon.
I'm thinking about creating a unit for each header (pico_gpio.pas, pico_uart.pas, rtc..), does it make sense?

I'm trying to get the blink sample You published working, the first compile and run on a pico without any issue, the problem is on the second example at full speed:
Code: Pascal  [Select][+][-]
  1. Compile Project, OS: embedded, CPU: arm, Target: project1.elf: Exit code 1, Errors: 9, Hints: 3
  2. Hint: Start of reading config file /home/turro/fpc-embedded/fpc/bin/x86_64-linux/fpc.cfg
  3. Hint: End of reading config file /home/turro/fpc-embedded/fpc/bin/x86_64-linux/fpc.cfg
  4. Verbose: Free Pascal Compiler version 3.3.1-r48418 [2021/02/04] for arm
  5. Verbose: Copyright (c) 1993-2020 by Florian Klaempfl and others
  6. Verbose: Target OS: Embedded
  7. Verbose: Compiling project1.lpr
  8. project1.lpr(15,10) Hint: Local proc "__aeabi_uidiv" is not used
  9. Verbose: Assembling project1
  10. Error: /home/turro/fpc-embedded/projects/Blinky_pico/clocks.c.obj: In function `clock_configure':
  11. Error: /home/turro/Documenti/Raspberrypico/pico-sdk/src/rp2_common/hardware_clocks/clocks.c:52: undefined reference to `__aeabi_uldivmod'
  12. Error: /home/turro/Documenti/Raspberrypico/pico-sdk/src/rp2_common/hardware_clocks/clocks.c:46: undefined reference to `__assert_func'
  13. Error: /home/turro/fpc-embedded/projects/Blinky_pico/pll.c.obj: In function `pll_init':
  14. Error: /home/turro/Documenti/Raspberrypico/pico-sdk/src/rp2_common/hardware_pll/pll.c:26: undefined reference to `__assert_func'
  15. Error: /home/turro/Documenti/Raspberrypico/pico-sdk/src/rp2_common/hardware_pll/pll.c:29: undefined reference to `__assert_func'
  16. Error: /home/turro/Documenti/Raspberrypico/pico-sdk/src/rp2_common/hardware_pll/pll.c:35: undefined reference to `__assert_func'
  17. Error: /home/turro/Documenti/Raspberrypico/pico-sdk/src/rp2_common/hardware_pll/pll.c:39: undefined reference to `__assert_func'
  18. Linking /home/turro/fpc-embedded/projects/Blinky_pico/project1
  19. project1.lpr(51,0) Error: Error while linking
  20. project1.lpr(51,0) Verbose: There were 1 errors compiling module, stopping
  21. Verbose: Compilation aborted
  22. Verbose: /home/turro/fpc-embedded/fpc/bin/x86_64-linux/ppcrossarm returned an error exitcode
  23.  

Any suggestion?

MiR

  • Full Member
  • ***
  • Posts: 201
Re: Raspberry Pi Pico and Freepascal
« Reply #21 on: February 13, 2021, 02:33:57 pm »
I have already created units for most stuff, but to be able to publish those changes I need to do some groundwork to better support automagically building new versions of fpc+rtl as there are often also small changes needed to rtl and it is quite time-consuming to manually build & distribute binary builds  of fpc with better pico support.

But I think we are pretty close at having this covered, so please bear with me a few more days.....
 
Did you build the obj files from source yourself or did you use the checked in versions on github?
https://github.com/michael-ring/pico-fpcexamples

There has been a version 1.0.1 of the pico sdk, so if you built the obj yourself they might differ a bit.

If you did not build them yourself and used mine I will have to clean up my mess, so please let me know  ;)

Michael

turronet

  • New Member
  • *
  • Posts: 15
Re: Raspberry Pi Pico and Freepascal
« Reply #22 on: February 13, 2021, 03:31:47 pm »
I confirm that using c.objs taken from fpc-examples github compiles and blink, I was previously using c.obj compiled from scratch by me, I assumed they were the same but probably few updates in the sdk make them different.
Ok I wait for Your next update, I trust You, please free me from python  :)

MiR

  • Full Member
  • ***
  • Posts: 201
Re: Raspberry Pi Pico and Freepascal
« Reply #23 on: February 13, 2021, 09:16:46 pm »
Just found this interesting project on github:

https://github.com/majbthrd/pico-debug

looks like it is possible to debug one single raspi with itself.....

MarkMLl

  • Hero Member
  • *****
  • Posts: 2427
Re: Raspberry Pi Pico and Freepascal
« Reply #24 on: February 13, 2021, 10:11:30 pm »
Just found this interesting project on github:

https://github.com/majbthrd/pico-debug

looks like it is possible to debug one single raspi with itself.....

Now that's /very/ interesting, and immediately has the Pico leapfrogging the Teensy which has been promising proper debugging for years... provided obviously that its I/O complement is adequate.

It reminds me very much of something that Sun did with their earliest enterprise-grade servers, which had originally been designed by Xerox PARC: there were 4x CPUs per board, and one could be reserved to debug the OS etc. running on the others.

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

MiR

  • Full Member
  • ***
  • Posts: 201
Re: Raspberry Pi Pico and Freepascal
« Reply #25 on: February 16, 2021, 08:46:15 pm »
Thirdpartys are coming tothe party, found this nice tiny2040 board from Pimoroni, looks interesting for space constrained projects:


https://shop.pimoroni.com/products/tiny-2040

Picture:

https://cdn.shopify.com/s/files/1/0174/1800/products/tiny-2040-2_1024x1024.jpg?v=1613312180


MiR

  • Full Member
  • ***
  • Posts: 201
Re: Raspberry Pi Pico and Freepascal
« Reply #26 on: February 28, 2021, 09:38:10 pm »
It finally happened!!!

Perhaps you have seen it elsewhere but DonAlfredo has released a new Version of FPCUpdeluxe which makes instaling and configuring Lazarus + FPC for embedded targets an easy task.

To celebrate the Event I have updated the Wiki with new Articles and I have also uploaded improoved code to the githup repo for the pico....

Please have a look and let me know what else we need, which i2c/spi devices we should show closer in a Tutorial.

Many, many many Thanks to Don Alfredo who has spent quite some weekends to make this new version of FPCUPdeluxe happen.....

Here are some links:

The new Tutorial on how to use FPCUPdeluxe to install embedded targets:

https://wiki.freepascal.org/ARM_Embedded_Tutorial_-_Installing_Lazarus_and_Free_Pascal

Overview Page of Pico Tutorials:

https://wiki.freepascal.org/ARM_Embedded_Tutorial_-_FPC_and_the_Raspberry_Pi_Pico


MiR

  • Full Member
  • ***
  • Posts: 201
Re: Raspberry Pi Pico and Freepascal
« Reply #27 on: March 04, 2021, 04:37:00 pm »
I today received the TINY 2040, like the size!

AlanTheBeast

  • Full Member
  • ***
  • Posts: 185
  • My software never cras....
Re: Raspberry Pi Pico and Freepascal
« Reply #28 on: March 07, 2021, 08:13:36 pm »
Pico looks great!

The lack of an FPU might be a turn-off for my current project, however, but once I have timing on it (RPi3 B+ / 4B) I might get the Pico to see if it could handle the load.  (I confess that the 4B is probably brute force for the project).  Lots of FP in it however.  To date the project does not use analog I/O but I was thinking of BITEing the project once all is together on the sensor end and that would need analog support (separate small board perhaps).

I've been off in Ultibo land for the weekend.  Nice OS-less environment with an awful lot of device support and a "Lazarus-Ultibo" IDE.  Need to hook deeper - still waiting on h/w from the US (GPS, gyro/accel)...
Everyone talks about the weather but nobody does anything about it.
..Samuel Clemens.

MiR

  • Full Member
  • ***
  • Posts: 201
Re: Raspberry Pi Pico and Freepascal
« Reply #29 on: April 02, 2021, 05:02:21 pm »
Quick update, obj files were updated to latest v1.1.1 of pico sdk, a few days ago support for st7789 displays was added.

 

TinyPortal © 2005-2018