5115 views|13 replies

58

Posts

1

Resources
The OP
 

[Raspberry Pi Pico Review] 1. Develop Pico without MicroPython and C++ [Copy link]

 
This post was last edited by tjCFeng on 2021-3-23 13:38

Winter has gone and spring has arrived. After the New Year, Pico is finally here. This is my first time applying for a development board on EEWorld. I am very grateful to be selected and to start a new trial journey on EEWorld. RPI Pico's RP2040 is a new thing with pretty good performance. Although it is slightly inferior to ESP32 in terms of price and configuration, the unique PIO function is a highlight. I will focus on learning about it later. Perhaps future microcontrollers will have this function. Pico is currently priced at US$4. Excluding other things, RP2040 is equivalent to about RMB 20. There are many microcontrollers of this level in China. I will pick one to compare.

RPI Pico's main development method is MicroPython, which is really convenient to develop. You can run it by downloading the source code directly. However, due to inherent limitations, MicroPython occupies more memory and needs to embed an interpreter in the MCU. At the same time, MicroPython is an interpreted language, which will definitely have some impact on performance. RPI Pico also provides C++ development methods. I tried to install it, but it was only successful on CLion, not on VSCode. There are too many places to set up, which is very inconvenient so far. I look forward to better plug-ins and other things in the future.


After trying the C++ of RPI Pico, I accidentally discovered that FreePascal can also compile Pico programs, which immediately aroused my interest. Before learning embedded development, I had been working on Delphi programs for more than ten years, and I had deep feelings for it, which can be regarded as a kind of sentiment. Since Borland added OOP features to Pascal, Delphi has changed from a tool to a language. Although Delphi has declined with Borland due to commercial reasons, some of Delphi's concepts are still very advanced. A hero does not mention his past achievements. The paid Delphi gradually disappeared, and the free FreePascal came. The IDE name is Lazarus, spicy pork shreds. Lazarus is different from Delphi in direction. Not only is it 99% compatible with Delphi in syntax, it is also known as write once and compile everywhere on various platforms. In other words, after writing a program, it can be compiled into a local executable file regardless of Win, Linux, or MAC, and it can also be compiled on Android and iOS. The most important thing is that it is related to Pico, and embedded ARM is not a problem.


Whether it is for sentiment or to add another development method for Pico, I broke my promise. I originally planned to use C++ to encapsulate the library, but now I am going to use Pascal, and use classes to implement it, which will be more convenient to call. Let me say a little more here. Pascal is a compiled language, and its efficiency is similar to C. It will definitely be higher than MicroPython, Lua and the like. It can also support Debug online debugging, so as long as it is easy to use, you can rest assured about the performance.


Let's get down to business and install Lazarus. Lazarus provides binary files for various platforms, but there is a more convenient installation method. First, go to

链接已隐藏,如需查看请登录或者注册
to download the fpcupdeluxe installation tool.

After running, select the path to be installed in the upper left corner, and then click the "Pico" button below

All that's left is to wait, without doing anything else, until the installation is complete.

After installation, a shortcut will be created on the desktop. Run it

An old Delphi7-like separated IDE is released, with a window on it. Click the green triangle in the upper left corner to get a Windows program with an interface. This program can run in various systems from Win95 to Win10 without any runtime support. The same is true for Linux and MAC. Of course, this window has nothing to do with Pico, and Pico cannot display a window.

If you are not used to this separation mode, it doesn’t matter. You can set it up and change the IDE language to Chinese.

Needless to say, the Chinese settings are in the menu "Tools->Options", and there are other settings according to your own habits. The fusion mode is not in the settings. In the menu "Package->Install/Uninstall Package", select "anchordocking" and "anchordockingdsgn", then click "Install->Save and Recompile IDE", and it will automatically restart after completion, and the appearance will change.

This is much better. Open the Lazarus installation folder

The four files are over 650M, isn't it too big? Don't be afraid, there is a way. Lazarus.old.exe can be deleted directly, which is the backup file when recompiling just now and is no longer needed. Then find strip.exe in the fpc folder and copy it. Do not execute it. Hold down the mouse and drag the large file onto strip.exe

The same is true for other files. Let's take a look at the current size.

I think you can accept it.

So far, the IDE settings are complete. What else is there to do? Download the example from

链接已隐藏,如需查看请登录或者注册
and unzip it. First open the simplest blinky project.

There are a lot of things here, but only two are useful. The lpi file is the project file, and the lpr file is the project code, so you need to open the lpi. Several lpis correspond to a series of development boards of rp2040. We use Pico, so of course we need to open the lpi of pico. There is no associated file when installing the IDE just now, so just select Lazarus.exe to open it.

After opening, ignore the code and directly click the menu "Run->Build". The compilation is completed instantly and the prompt is successful. What changes will occur after success?

There is a new folder called bin under blinky. All the required files are in it. You should be familiar with the uf2 file. Now we need to verify the compilation result.

Plug the Pico into the computer's USB and it will recognize a new partition. Just like other development methods, drag the uf2 file into it and the effect will appear immediately.

The lights flashed.

So far, the whole process from installing Lazarus to setting up, compiling and running is over. It is quite simple, right? There is nothing to input. The key is the network speed, especially for github, svn and the like. If you are blocked by a firewall, it will greatly affect the installation speed. Find a way to turn it over by yourself.
(End)

This post is from DIY/Open Source Hardware

Latest reply

It's a pity that Shenqi has no good father   Details Published on 2021-6-2 17:55
 

662

Posts

0

Resources
2
 

I haven't seen information about Pascal language for a long time. Thanks for sharing.

This post is from DIY/Open Source Hardware

Comments

Thanks  Details Published on 2021-3-23 11:36
 
 

58

Posts

1

Resources
3
 
slotg posted on 2021-3-23 11:26 I haven't seen information about Pascal language for a long time. Thanks for sharing.

Thanks

This post is from DIY/Open Source Hardware
 
 
 

1131

Posts

17

Resources
4
 

Good, I learned

This post is from DIY/Open Source Hardware
 
 
 

1w

Posts

204

Resources
5
 

Interesting. It's rare to see a different approach.

This post is from DIY/Open Source Hardware
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle
 
 
 

1455

Posts

1

Resources
6
 

Can you post the software? It saves everyone from having to climb over the firewall!

This post is from DIY/Open Source Hardware

Comments

Too big, 1.5G after compression.  Details Published on 2021-3-24 12:31
 
 
 

58

Posts

1

Resources
7
 
jinglixixi posted on 2021-3-24 10:13 Can you post the software? It saves everyone from climbing over the firewall!

Too big, 1.5G after compression.

This post is from DIY/Open Source Hardware
 
 
 

1455

Posts

1

Resources
8
 

Oh, it’s still not small!

This post is from DIY/Open Source Hardware

Comments

Yes, this tool will download all the source code and compile it to generate the executable files of the IDE and compiler, so it will be very large, but it is guaranteed to be the latest version. You can also directly download the Lazarus installation file and the corresponding compiler and install it directly, which should be much smaller, only a few hundred megabytes. I haven't tried it yet.  Details Published on 2021-3-24 13:24
 
 
 

58

Posts

1

Resources
9
 
jinglixixi posted on 2021-3-24 13:06 Oh, it’s still not small!

Yes, this tool will download all the source code and compile it to generate the executable files of IDE and compiler, so it will be very large, but it is guaranteed to be the latest version. You can also directly download the installation file of Lazarus and the corresponding compiler and install it directly, which should be much smaller, only a few hundred megabytes. I haven't tried it yet, but you can try it if you are interested.

This post is from DIY/Open Source Hardware
 
 
 

1455

Posts

1

Resources
10
 

Got it. Let’s use Thonny for now.

This post is from DIY/Open Source Hardware
 
 
 

7462

Posts

2

Resources
11
 

I miss Delphi7 so much.

This post is from DIY/Open Source Hardware

Comments

Daoyou  Details Published on 2021-6-2 10:58
Daoyou  Details Published on 2021-3-25 14:59
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 
 

58

Posts

1

Resources
12
 
freebsder posted on 2021-3-25 14:35 I miss Delphi7 so much.

Daoyou

This post is from DIY/Open Source Hardware
 
 
 

196

Posts

0

Resources
13
 
freebsder posted on 2021-3-25 14:35 I miss Delphi7 so much.

Hello fellow! Delphi is really simple and easy to use

This post is from DIY/Open Source Hardware

Comments

It's a pity that Shenqi has no good father  Details Published on 2021-6-2 17:55
 
 
 

7462

Posts

2

Resources
14
 
leifengfirst posted on 2021-6-2 10:58 Hello fellow Taoist! Delphi is really simple and easy to use

It's a pity that Shenqi has no good father

This post is from DIY/Open Source Hardware
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list