PlatformIO SAM4S4B

Hello,
I am using Platformio with VSCode. I will work with the SAM4S4B processor, but when I create a new project, I cannot find “SAM4S4B” in the “boards” section. Please help. Thank you in advance.

@ivankravets help please

I created a test project based on the CMSIS pack for SAM4 from Keil and the libsam and startup files and linker scripts from Arduino:

Check out if you can build

and flash it via a e.g. J-Link. OpenOCD does not support SAM4S chips, so you need some other means to program it…

@maxgerhardt First of all, thank you for responding.

Can you tell me clearly which libraries I need to use to learn the screen interface with PanelDue? If possible, I would like to do it in such a way that my priority is VS Code + PlatformIO. Can you help me start with drawing something on the PanelDue screen and help me learn this job? Can you share if there is a video link or article to learn this? Thank you.

So you actually have a PanelDue 7i? That’s important information, because we already have

Yes, I have a PanelDue v3 7-inch screen. @maxgerhardt

I’ve just updated https://github.com/maxgerhardt/PanelDueFirmware to include support for what that firmware calls the PanelDue “v3-7.0” and “v3-7.0c” as well as as “7i” devices, not sure which one you have. That firmware does have a display library built into it.

*  Executing task in folder paneldue1: C:\Users\User\.platformio\penv\Scripts\platformio.exe run --environment paneldue_v3_70 

Processing paneldue_v3_70 (board: atsam4s4b; platform: atmelsam@8.3.0)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelsam/atsam4s4b.html
PLATFORM: Atmel SAM (8.3.0) > Generic ATSAM4S4B
HARDWARE: ATSAM4S4B 120MHz, 64KB RAM, 256KB Flash
DEBUG: Current (atmel-ice) External (atmel-ice, blackmagic, jlink, stlink)
PACKAGES: 
 - toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 3 compatible libraries
Scanning dependencies...
Dependency Graph
|-- qoi
Building in release mode
Compiling .pio\build\paneldue_v3_70\src\FileManager.o
Compiling .pio\build\paneldue_v3_70\src\FlashData.o
Compiling .pio\build\paneldue_v3_70\src\Hardware\FlashStorage.o
Compiling .pio\build\paneldue_v3_70\src\Hardware\Mem.o
Compiling .pio\build\paneldue_v3_70\src\Hardware\RotaryEncoder.o
Compiling .pio\build\paneldue_v3_70\src\Hardware\SerialIo.o
Compiling .pio\build\paneldue_v3_70\src\Hardware\SysTick.o
Compiling .pio\build\paneldue_v3_70\src\Hardware\UTFT.o
Compiling .pio\build\paneldue_v3_70\src\Hardware\UTouch.o
Compiling .pio\build\paneldue_v3_70\src\Icons\HomeIcons.o
Compiling .pio\build\paneldue_v3_70\src\Icons\KeyIcons.o
Compiling .pio\build\paneldue_v3_70\src\Icons\MiscIcons.o
In file included from src\FileManager.hpp:13:0,
                 from src\FileManager.cpp:8:
src\FirmwareFeatures.hpp:11:10: fatal error: General/Bitmap.h: No such file or directory
 #include <General/Bitmap.h>
          ^~~~~~~~~~~~~~~~~~
Compiling .pio\build\paneldue_v3_70\src\Icons\NozzleIcons.o
compilation terminated.
Compiling .pio\build\paneldue_v3_70\src\Library\Misc.o
Compiling .pio\build\paneldue_v3_70\src\Library\Thumbnail.o
*** [.pio\build\paneldue_v3_70\src\FileManager.o] Error 1
In file included from src\FlashData.cpp:1:0:
src\FlashData.hpp:8:10: fatal error: General/SimpleMath.h: No such file or directory
 #include "General/SimpleMath.h"
          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\paneldue_v3_70\src\FlashData.o] Error 1
src\Hardware\Mem.cpp:9:10: fatal error: General/SimpleMath.h: No such file or directory
 #include <General/SimpleMath.h>
          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from src\Hardware\SerialIo.cpp:8:0:
src\Hardware\SerialIo.hpp:14:10: fatal error: General/String.h: No such file or directory
 #include <General/String.h>
          ^~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from src/UI/UserInterface.hpp:11:0,
                 from src\Hardware\SysTick.cpp:9:
src/FirmwareFeatures.hpp:11:10: fatal error: General/Bitmap.h: No such file or directory
 #include <General/Bitmap.h>
          ^~~~~~~~~~~~~~~~~~
compilation terminated.
src\Hardware\FlashStorage.cpp:4:10: fatal error: General/SimpleMath.h: No such file or directory
 #include <General/SimpleMath.h>
          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\paneldue_v3_70\src\Hardware\Mem.o] Error 1
*** [.pio\build\paneldue_v3_70\src\Hardware\SerialIo.o] Error 1
*** [.pio\build\paneldue_v3_70\src\Hardware\FlashStorage.o] Error 1
*** [.pio\build\paneldue_v3_70\src\Hardware\SysTick.o] Error 1
In file included from src\Hardware\UTFT.cpp:52:0:
src\Hardware\UTFT.hpp:53:10: fatal error: General/SafeVsnprintf.h: No such file or directory
 #include <General/SafeVsnprintf.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\paneldue_v3_70\src\Hardware\UTFT.o] Error 1
src\Library\Thumbnail.cpp:5:10: fatal error: base64.h: No such file or directory

****************************************************************
* Looking for base64.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:base64.h"
* Web  > https://registry.platformio.org/search?q=header:base64.h
*
****************************************************************

 #include "base64.h"
          ^~~~~~~~~~
compilation terminated.
src\Hardware\RotaryEncoder.cpp:11:10: fatal error: General/SimpleMath.h: No such file or directory
 #include <General/SimpleMath.h>
          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\paneldue_v3_70\src\Library\Thumbnail.o] Error 1
*** [.pio\build\paneldue_v3_70\src\Hardware\RotaryEncoder.o] Error 1
=========================================================================================== [FAILED] Took 1.24 seconds ===========================================================================================

Environment     Status    Duration
--------------  --------  ------------
paneldue_v3_70  FAILED    00:00:01.240
===================================================================================== 1 failed, 0 succeeded in 00:00:01.240 ===================================================================================== 

 *  The terminal process "C:\Users\User\.platformio\penv\Scripts\platformio.exe 'run', '--environment', 'paneldue_v3_70'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it.

You didn’t clone the repository recursively. It has submodules in lib/ that are needed. Delete the old project and redownload it properly.

git clone --recursive https://github.com/maxgerhardt/PanelDueFirmware.git

What I want is the raw version of the project. So I want to write the interface myself. For this I need the raw version. There is a user interface in it.

Sure, that’s what you want. And you get that by extracting only the files you need from that project. In any case, it makes sense to first of all test a known working firmware to see if it can talk to the display at all.

Yes, after I did the compilation process, I loaded the binary file to the processor and ran the interface. How should I do now? @maxgerhardt

So upload worked without a problem? Did the firmware do anything, display anything on the display?

The firmware worked properly, no problem.

Great! That means you can now just pick the libraries and code files you need to create a more barebones version of the project (the display library, etc.)

My main issue is that I want to set the button heights through a parameter, but the current structure doesn’t support this, so I am trying to modify it. However, since all the classes are interconnected, I’m encountering issues. Instead of fixing this project, I would like to create my own interface. To make this easier, it would be extremely helpful to have a version of the project with only the necessary libraries defined. Could you help me with this?

You don’t need to throw away the whole Display and UI library, just modify or create a new button class in which you can control the height.

Thank you very much for your suggestion. I had already tried that, but the button text didn’t center properly within the button. I’ve come up with a few ideas to solve this issue, but they didn’t work when I tried them. How can I fix this problem?

Not sure on that, would need more debugging.
But in any case, no goalpost moving. The original question is answered- A project for the chip could be created.

1 Like

Sure, thank you. I will open a new topic for this.