Hello,
I like to use fpc as a C alternative to program Esp32 micro-controllers.
I started with a clean Linux openSUSE Leap VirtualBox image and installed fpcupdeluxe.
Using fpcupdeluxe I installed the stable FPC and stable Lazarus version.
Compiling and running hello,pas was as expected.
hello.pas
=========
program hello;
uses sysutils;
var n : Integer;
begin
while true do
begin
n += 1;
writeLn(n, ' Hello world');
sleep(1000);
end;
end.
Then using fpcupdeluxe I installed the trunk FPC and trunk Lazarus version for cross xtensa / freertos installed by clicking the ESP32 button.
Compiling / running the same hello.pas from above compiled with the message Success in green en resulted into a hello file [1.44 MB] in my project folder.
This file was uploded into the esp32 by:
Esp32 upload (as with micropython)
=============================
1. $ . ~/work/venv_esp/bin/activate
(venv) esptool.py -p /dev/ttyUSB0 -c esp32 flash_id --> flash info
(venv) esptool.py -p /dev/ttyUSB0 -c esp32 erase_flash --> erase flash
(venv) esptool.py -p /dev/ttyUSB0 -c esp32 -b 460800 write_flash -z 0x1000 hello
(venv) deactivate
2. $ picocom -b 115200 /dev/ttyUSB0
--> flash read err, 1000
Ctrl-a-x
Esp32 upload (as in fpc wiki)
==========================
1. ref:
https://wiki.lazarus.freepascal.org/Xtensa2. $ . ~/work/venv_esp/bin/activate
(venv) esptool.py -p /dev/ttyUSB0 -c esp32 flash_id --> flash info
(venv) esptool.py -p /dev/ttyUSB0 -c esp32 erase_flash --> erase flash
3. from wiki:
(venv) esptool.py -p /dev/ttyUSB0 -b 460800 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x1000 bootloader.bin 0x8000 partition-table.bin 0x10000 hello.bin ?????
4. as bootloader.bin and partition-table.bin are not generated by fpcupdeluxe, I assume its embedded in hello
(venv) esptool.py -p /dev/ttyUSB0 -b 460800 --before default_reset --after hard_reset -c esp32 write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x1000 hello
5. $ picocom -b 115200 /dev/ttyUSB0
--> flash read err, 1000
Ctrl-a-x
6. (venv) esptool.py -p /dev/ttyUSB0 -b 460800 --before default_reset --after hard_reset -c esp32 write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x10000 hello
7. $ picocom -b 115200 /dev/ttyUSB0
--> flash read err, 1000
Ctrl-a-x
8. also tried in forced bootloader mode with boot and rst buttons --> same results
My question is how to get this hello file running on a esp32?
or how to make an image that is running on the esp32
thanks in advance.