Recent

Author Topic: Pine64 Pinenut 01S / 12S BL602  (Read 5235 times)

rsz

  • New Member
  • *
  • Posts: 45
Pine64 Pinenut 01S / 12S BL602
« on: August 26, 2021, 09:00:22 am »
Hi,

Has anyone got a Free Pascal program compiled and running on the Pine64 Pinenut BL602 model 01S or 12S? These seem to be great and they compete with ESP8266.

BL602 is 32bit RISC-V. FreeRTOS and AliOS supposedly have support for it.
https://wiki.pine64.org/wiki/Nutcracker
https://lupyuen.github.io/articles/pinecone

How would I even get started developing with Free Pascal for this? I suppose the target would be embedded without any OS?
My experience with microcontrollers is pretty much limited to writing programs in C/C++ for nodemcu (ESP8266) and there the Arduino IDE takes care of pretty much everything, but I'd like to switch to using Free Pascal if possible.

ccrause

  • Hero Member
  • *****
  • Posts: 845
Re: Pine64 Pinenut 01S / 12S BL602
« Reply #1 on: August 26, 2021, 10:29:26 am »
In theory it is possible, in practice I think a bit of (mostly admin type, not low level compiler) work is required to support the E24 controllers, including a controller definition file added to the embedded RTL folder.  Then you can start programming bare metal.

FPC also has basic support for FreeRTOS but RISC-V is not yet supported.  I don't think this will entail lots of work, see e.g. ESP32, which pulls in low level hardware functionality from Espressif's SDK.  To access further SDK functionality requires translation of the SDK header files to pascal.

Another option is to look at mbf-freertos, seems to lack RISC-V support, so a bit of extra work is required here too. 

This is just my opinion, others may give you better information...

MiR

  • Full Member
  • ***
  • Posts: 246
Re: Pine64 Pinenut 01S / 12S BL602
« Reply #2 on: August 26, 2021, 10:50:42 am »
I think Christo has already touched all major points....

One more think about:

Espressif has recently released a new SoC which is also RISC-V based and very affordable:

https://www.espressif.com/en/products/socs/esp32-c3

This SoC is pretty similar to the Pine chip when it comes to Specs. I already have a few dev-boards and sooner or later support will pop up in mbf-freertos but it is not something I have started working on.
There are already dev boards available for $3 on Aliexpress.
As it also uses the same SDK as the other Espressif Chips porting will be a lot easier than for a brand new chip.

Anyway, back to your questions, if you want to get your feet wet with the pine chip then the easiest way is to port the controller definitions that you want to try to Freepascal and add those defs in the embedded target.

This will allow you to do the usual stuff, blink LED's, SPI, I2C and will likely keep you busy for a while (and is also great fun)

I can help you to integrate your pascal unit into freepascal, this is an easy task, you only need to know a few files that you need to change.

For using WiFi on the chip you are better off with FreeRTOS but this task is a bit more complicated, so if this is not the highest point on your priority list I'd wait until support for esp32-c is available, then it will be a lot easier for you to actually make the pine chip work.

Michael
« Last Edit: August 26, 2021, 01:51:42 pm by MiR »

rsz

  • New Member
  • *
  • Posts: 45
Re: Pine64 Pinenut 01S / 12S BL602
« Reply #3 on: August 27, 2021, 11:02:49 am »
Thanks for the detailed replies. I was asking because once I run out of ESP8266's I'll have to decide what I want to move to next for my projects.
I didn't know about ESP32-C3, it also seems like a good choice.

I have a few projects that I want to get done this year but they require WiFi. If the WiFi functionality is available with ESP8266 I'll try to get these projects done using Free Pascal.
Are there any example projects for the ESP8266 written in Pascal (preferably using WiFi) I could have a look at, or is it essentially the same as the C examples from the SDK just that one calls the C functions from Pascal?

Maybe once I got a few projects working and a bit more experience with this I'll revisit the Pine chip.

ccrause

  • Hero Member
  • *****
  • Posts: 845
Re: Pine64 Pinenut 01S / 12S BL602
« Reply #4 on: August 27, 2021, 01:57:20 pm »
I have a few projects that I want to get done this year but they require WiFi. If the WiFi functionality is available with ESP8266 I'll try to get these projects done using Free Pascal.
Are there any example projects for the ESP8266 written in Pascal (preferably using WiFi) I could have a look at, or is it essentially the same as the C examples from the SDK just that one calls the C functions from Pascal?
Have a look at these examples.  You can get prebuilt libraries for Linux here or use Michael's espsdk4fpc script to pull, build and install the necessary build tools (including a python venv).

The examples are very close to the the C examples from the SDK, except for the use of Pascal specific functionality such as write/writeln, GetMem/FreeMem, threads etc.

MiR

  • Full Member
  • ***
  • Posts: 246
Re: Pine64 Pinenut 01S / 12S BL602
« Reply #5 on: August 27, 2021, 04:35:56 pm »
One important thing to remember, building for esp will only work on linux and on MacOSX, Windows is not (yet) supported.

Easiest way to get working Crosscompilers is to use fpcupdeluxe....
https://wiki.lazarus.freepascal.org/fpcupdeluxe

Michael

rsz

  • New Member
  • *
  • Posts: 45
Re: Pine64 Pinenut 01S / 12S BL602
« Reply #6 on: August 28, 2021, 09:31:36 am »
Those examples look great, I'll give it a shot.
I use Linux exclusively so I don't need to build on Windows so that's fine.

Thanks.

 

TinyPortal © 2005-2018