hpssjellis / my-examples-for-the-arduino-portentaH7

My examples fir the new Arduino Pro board the Portenta H7
MIT License
82 stars 9 forks source link

how to set up PlatformIO in order to use RPC (RPC_internal.h not found)? #3

Closed diplodocuslongus closed 2 years ago

diplodocuslongus commented 2 years ago

Hello Jeremy, This is an incredible amount of resource you have put together here. I'm getting started with both the portenta and platformio, I can run the blink example and the dual core blink, but not the RPC blink example my02b-dual-core-RPC.ino, PlatformIO complains it can't find RPC_internal.h:

$ pio run
Processing portenta_h7_m7 (platform: ststm32; board: portenta_h7_m7; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/portenta_h7_m7.html
PLATFORM: ST STM32 (15.2.0) > Arduino Portenta H7 (M7 core)
HARDWARE: STM32H747XIH6 480MHz, 511.35KB RAM, 768KB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, jlink, stlink)
PACKAGES: 
 - framework-arduino-mbed 2.6.1 
 - tool-dfuutil 1.9.200310 
 - 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 31 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/portenta_h7_m7/src/main.cpp.o
Compiling .pio/build/portenta_h7_m7/FrameworkArduino/USB/USBSerial.cpp.o
Compiling .pio/build/portenta_h7_m7/FrameworkArduino/WMath.cpp.o
Compiling .pio/build/portenta_h7_m7/FrameworkArduino/abi.cpp.o
Compiling .pio/build/portenta_h7_m7/FrameworkArduino/api/Common.cpp.o
Compiling .pio/build/portenta_h7_m7/FrameworkArduino/api/IPAddress.cpp.o
Compiling .pio/build/portenta_h7_m7/FrameworkArduino/api/PluggableUSB.cpp.o
Compiling .pio/build/portenta_h7_m7/FrameworkArduino/api/Print.cpp.o
Compiling .pio/build/portenta_h7_m7/FrameworkArduino/api/Stream.cpp.o
src/main.cpp:29:10: fatal error: RPC_internal.h: No such file or directory

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

and I can't find anything about RPC_internal.h in the PlatformIO registry, nor could I find anything obvious searching for mbed in the registry search form at : I've read on another forum (arduino one? ) that you also use PlatformIO, so I thought I'd ask you here (though this is definitely a PlatformIO question...):

how do I install RPC_internal.h in PlatformIO or setup PlatformIO so it find this header?

Thanks, Ludo

hpssjellis commented 2 years ago

@diplodocuslongus Arduino deprecated RPC, and I haven't caught up with fixing things. Libraries are a bit of a pain in Platformio. as my students go through my course we should figure out all the lib dependencies.

Have you installed the Portenta Pro Community Solutions. It has most of my up to date code. Search the IDE for "community" it also installs onto Platformio .

try:


/*
 * e-print-from-m4-core-rpc.ino for the Portenta H7
 *
 * GNU GENERAL PUBLIC LICENSE
 * Use at your own risk.
 ************************************************ Important stuff if needed ****************************************
 *
 *
 *
 ********************************************************** end ****************************************************
 *
 *
 * The PortentaH7 M4 core can not print to the serial monitor
 * On the M4 core if you do a Serial.Println it goes to the TX RX UART output pins
 * This program uses RPC to redirect Serial.println to the M7 core 
 * so that regular sketches still work with serial monitor output from the M4 core
 *
 * 
 * updated August 2nd, 2020
 * by Jeremy Ellis
 * Twitter @rocksetta
 * Website https://www.rocksetta.com
 *
 * I have re-written this to make larger programs easier
 * by seperating the M7 and M4 code completely.
 *
*/

#ifdef CORE_CM7   // Start M7 programming

#include "RPC.h"  // comes with the mbed board installation

void setup() {
   bootM4(); 
   Serial.begin(115200);
   RPC.begin();
}

void loop() {

   while (RPC.available()) {
      Serial.write(RPC.read()); 
   }  
  // delay(1);
}

#endif              // End all M7 core programming

/////////////////////////////////////////////////////////////////////////////////////////////

#ifdef CORE_CM4    // Start M4 programming

#include "RPC.h"  // comes with the mbed board installation

#define Serial RPC  // So the M4 regular serial prints to RPC

void setup(){  

  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin();
  // while (!Serial);  // Please don't do this it messes up beginners

}

void loop() {

  Serial.println( ); delayMicroseconds(1234);
  Serial.println("A0 Analog Read max = 1023, Actual Value: "+String(analogRead(A0)) ); delayMicroseconds(1234);
  Serial.println("A1 Analog Read max = 1023, Actual Value: "+String(analogRead(A1)) ); delayMicroseconds(1234);
  Serial.println("A2 Analog Read max = 1023, Actual Value: "+String(analogRead(A2)) ); delayMicroseconds(1234);
  Serial.println("A3 Analog Read max = 1023, Actual Value: "+String(analogRead(A3)) ); delayMicroseconds(1234);
  Serial.println("A4 Analog Read max = 1023, Actual Value: "+String(analogRead(A4)) ); delayMicroseconds(1234);
  Serial.println("A5 Analog Read max = 1023, Actual Value: "+String(analogRead(A5)) ); delayMicroseconds(1234);
  Serial.println("A6 Analog Read max = 1023, Actual Value: "+String(analogRead(A6)) ); delayMicroseconds(1234);
  Serial.println("-----------------------------------------------------------------"); delayMicroseconds(1234);
  Serial.println(); delayMicroseconds(1234);

  // Flash LED 3 times
  digitalWrite(LED_BUILTIN, LOW);   
  delay(10);                      
  digitalWrite(LED_BUILTIN, HIGH);    
  delay(10);                    

  digitalWrite(LED_BUILTIN, LOW);   
  delay(10);                      
  digitalWrite(LED_BUILTIN, HIGH);    
  delay(10);      

  digitalWrite(LED_BUILTIN, LOW);   
  delay(10);                      
  digitalWrite(LED_BUILTIN, HIGH);    
  delay(100);    // longer wait 

}

#endif            // End all M4 core programming

/*
* Clickable links for helpful information
* By @rocksetta
* March, 2021
* GNU GENERAL PUBLIC LICENSE
* Use at your own risk.
*
*
*
*  Artduino Pro Links:
*
*  https://store.arduino.cc/usa/portenta-h7
*  https://forum.arduino.cc/index.php?board=148.0
*  https://www.arduino.cc/pro/tutorials/portenta-h7
*
*  Rocksetta links:
* 
*  https://twitter.com/rocksetta
*  https://github.com/hpssjellis/portenta-pro-community-solutions
*  https://github.com/hpssjellis/my-examples-for-the-arduino-portentaH7
*  https://github.com/hpssjellis/arduino-high-school-robotics-course
*  https://www.youtube.com/playlist?list=PL57Dnr1H_egtm0pi-okmG0iE_X5dROaLw
*
*
*
*/
diplodocuslongus commented 2 years ago

Thanks. I installed your library in both platformIO and the arduino IDE (1.8.19), it compiles fine in the IDE but in PIO it complains it can't find the asio.hpp header when referring to rpclib:

$ pio run

[...]

Dependency Graph
|-- <RPC> 1.0
|   |-- <rpclib> 1.0.0
|   |-- <openamp> 1.0
Building in release mode
Compiling .pio/build/portenta_h7_m7/src/main.cpp.o
Generating LD script .pio/build/portenta_h7_m7/cpp.linker_script.ld
Compiling .pio/build/portenta_h7_m7/lib9bb/rpclib/format.cpp.o
Compiling .pio/build/portenta_h7_m7/lib9bb/rpclib/rpc/client.cc.o
Compiling .pio/build/portenta_h7_m7/lib9bb/rpclib/rpc/detail/client_error.cpp.o
/home/ludozb/.platformio/packages/framework-arduino-mbed/libraries/rpclib/src/rpc/client.cc:13:10: fatal error: asio.hpp: No such file or directory

asio.hpp isn't present anywhere here https://github.com/arduino/ArduinoCore-mbed, which is what is install in ~/.platformio, but does exists in the original rpclib repository : https://github.com/rpclib/rpclib, asio.hpp being here: https://github.com/rpclib/rpclib/tree/master/dependencies/include

But all that is way beyond my original issue... I'll see where is best to ask a question about my problem, most likely on the platformIO forum.

Ludo

hpssjellis commented 2 years ago

I let my students figure out the library dependencies. Platformio has a strange non-GUI way to do it.

For my pixy you have to add

lib_deps = arduino12/pixy2@^1.0.4

For the Grove OLED it is

lib_deps = olikraus/U8g2@^2.32.10

These go in your platfomio.ini file