Replies: 1 comment 2 replies
-
(1) You can get some things running (the simple SDK examples) by replacing main() with setup() and removing some unneeded bits like you said, but honestly if you have a SDK project, the default (2) You need to manually run (3) The The _Z... labels are C++ name mangled functions that aren't present in your link for some reason. See https://demangler.com/ to unscramble them. |
Beta Was this translation helpful? Give feedback.
-
Talented Coders:
Needed by the less talented: a tutorial on importing SDK source files into Arduino.
Those with little professional tool chain experience
who rely on example/template files as a jumping off point
have quite a challenge at this stage of development.
(It would seem that converting a rp2040 optimized SDK project
would be more expedient that starting with an old Arduino project)
My experience:
(1)
Got a simple single source file example working by removing stdio_init_all();
(taking more time than it should have)
(2)
Official SDK PIO example files don't include .pio.h files, for example:
blink.c contains #include "blink.pio.h" but source files only have "blink.pio"
https://github.com/raspberrypi/pico-examples/tree/master/pio/pio_blink
While Earl's Tone.cpp
arduino-pico/cores/rp2040/Tone.cpp contains: #include "tone.pio.h"
Has both tone.pio & tone.pio.h files
tone.pio.h contains:
// -------------------------------------------------- //
// This file is autogenerated by pioasm; do not edit! //
// -------------------------------------------------- //
Is pioasm needed to run SDK examples in Arduino?
(3)
External file organization/naming
Consulted pre-processing documentation and discussions.
https://arduino.github.io/arduino-cli/latest/sketch-build-process/#pre-processing
It appears that external .c and .h files are treated as C code while .ino are converted to .cpp
In an example for the SDK that includes a few old Arduino .c & .h files:
Trying to translate a Nokia LCD for Pi Pico example, that used a couple external .c and .h files,
Errors reported for: Documents/Arduino/Nokia_5110/Nokia_5110.ino:
warning: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
bool steep = (abs(y1 - y0) > abs(x1 - x0)); // guessing it's a C and C++ type mixup?
got these error messages for functions contained in external files:
undefined reference to
_Z8LCD_Demov' (.ino src: LCD_Demo();) undefined reference to
_Z12clearDisplayv' (.ino src: clearDisplay();)undefined reference to `_Z14Nokia5110_Initv' (.ino src: Nokia5110_Init();)
Guessing the odd Znn... must be intermediate process versions?
I tried "C" {} block marking on external handler calls, getting same errors with no effect.
Beta Was this translation helpful? Give feedback.
All reactions