T4.1 Aud lib + ILI9341_T4 & tgx 3D gfx libs co-existing for visualization

Status
Not open for further replies.

SteveBar

Well-known member
Hi Arvind,
I'm trying to migrate a combine project (T4.1 Aud lib + ILI9341_T4 & tgx 3D gfx libs) that I have running in the Arduino IDE to the PlatformIO via VSCode environment.

I'm just trying to get "hello world" to compile. :)

I'm getting some compile errors on fcn "_clip()" in the ILI9341_T4 lib from the PIO build attempt. The same lib compiles from the Arduino IDE no prob.
I was hoping you (or any one else for that matter) could help.


Code:
> Executing task: C:\Users\steve\.platformio\penv\Scripts\platformio.exe run <

Processing teensy41 (platform: teensy; board: teensy41; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy41.html
PLATFORM: Teensy (4.12.0) > Teensy 4.1
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 7.75MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
 - framework-arduinoteensy 1.153.0 (1.53)
 - toolchain-gccarmnoneeabi 1.50401.190816 (5.4.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 92 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Audio> 1.3      
|   |-- <SerialFlash>
|   |   |-- <SPI> 1.0
|   |-- <SPI> 1.0    
|   |-- <Wire> 1.0   
|   |-- <SD> 1.2.2   
|   |   |-- <SPI> 1.0
|-- <ILI9341_T4> 0.1
|   |-- <SPI> 1.0
|-- <tgx> 0.1
Building in release mode
Compiling .pio\build\teensy41\src\AudioGUIToolStuff.cpp.o
Compiling .pio\build\teensy41\src\main.cpp.o
Compiling .pio\build\teensy41\src\voice_allocator.cpp.o
Compiling .pio\build\teensy41\lib34b\SPI\SPI.cpp.o
Compiling .pio\build\teensy41\lib987\SerialFlash\SerialFlashChip.cpp.o
Compiling .pio\build\teensy41\lib987\SerialFlash\SerialFlashDirectory.cpp.o
Compiling .pio\build\teensy41\lib525\Wire\Wire.cpp.o
Compiling .pio\build\teensy41\lib525\Wire\WireIMXRT.cpp.o
Compiling .pio\build\teensy41\lib525\Wire\WireKinetis.cpp.o
Compiling .pio\build\teensy41\lib525\Wire\utility\twi.c.o
In file included from lib\ILI9341_T4\src/ILI9341_T4.h:27:0,
                 from src\main.cpp:3:
Compiling .pio\build\teensy41\libb5d\SD\File.cpp.o
lib\ILI9341_T4\src/ILI9341Driver.h: In member function 'void ILI9341_T4::ILI9341Driver::setLateStartRatio(double)':
lib\ILI9341_T4\src/ILI9341Driver.h:583:50: error: no matching function for call to 'ILI9341_T4::ILI9341Driver::_clip(double&, float, float)'
         _late_start_ratio = _clip(ratio, 0.1, 0.9);
                                                  ^
lib\ILI9341_T4\src/ILI9341Driver.h:1352:35: note: candidate: template<class T> static T ILI9341_T4::ILI9341Driver::_clip(T, T, T)
     template<typename T> static T _clip(T val, T min, T max)
                                   ^
lib\ILI9341_T4\src/ILI9341Driver.h:1352:35: note:   template argument deduction/substitution failed:
lib\ILI9341_T4\src/ILI9341Driver.h:583:50: note:   deduced conflicting types for parameter 'T' ('double' and 'float')
         _late_start_ratio = _clip(ratio, 0.1, 0.9);
                                                  ^
In file included from lib\tgx\src/tgx.h:36:0,
                 from src\main.cpp:4:
lib\tgx\src/Mesh3D.h: In member function 'void tgx::_MapPtr::free(const void*)':
lib\tgx\src/Mesh3D.h:262:42: error: 'extmem_free' was not declared in this scope
                     extmem_free((void *)p);
                                          ^
lib\tgx\src/Mesh3D.h: In member function 'void tgx::_MapPtr::freeAll()':
lib\tgx\src/Mesh3D.h:271:41: error: 'extmem_free' was not declared in this scope
                     extmem_free(_vals[k]);
                                         ^
lib\tgx\src/Mesh3D.h: In member function 'void* tgx::_MapPtr::malloc(const void*, size_t)':
lib\tgx\src/Mesh3D.h:294:45: error: 'extmem_malloc' was not declared in this scope
                     adr = extmem_malloc(size);
                                             ^
Compiling .pio\build\teensy41\libb5d\SD\SD.cpp.o
Compiling .pio\build\teensy41\libb5d\SD\cache_t3.cpp.o
Compiling .pio\build\teensy41\libb5d\SD\card_t3.cpp.o
*** [.pio\build\teensy41\src\main.cpp.o] Error 1
============================================================= [FAILED] Took 4.43 seconds =============================================================The terminal process "C:\Users\steve\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Code:
#include <Arduino.h>
#include <Audio.h>
#include <ILI9341_T4.h>
#include <tgx.h>

void setup() {
  Serial.begin(9600);
  Serial.println("hello world");
}

void loop() {

}

Code:
; PlatformIO.ini...
[env:teensy41]
platform = teensy
board = teensy41
framework = arduino
build_flags = -DUSB_MIDI_SERIAL, -D TEENSY_OPT_FASTEST
build_type = release
 
Hi,

The clip error seems to be a mistake from my part where I mixed double and float carelessly. Hopefully, it should be ok now if you pull the the latest version of the library from github.

As for the second error, I think extmeme_malloc() and extmem_free() are rather recent additions. You probably have an old version of Teensyduino. Try v1.54 and it may fix it...
 
I had a friend help me look at these and we found a solution to both...

As you mentioned for the _clip(), casting the fixed it... "_late_start_ratio = _clip(ratio, (double)0.1, (double)0.9);"
A bit baffling why it compiles for Arduino IDE and not PlatformIO IDE. Maybe a compiler switch is different???

As for the extmeme_malloc()...
This version works - used by the Arduino IDE (C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4\wiring.h)
This version NOT works - used by PlatformIO IDE (C:\Users\steve\.platformio\packages\framework-arduinoteensy\cores\teensy4\wiring.h)
I'll update the Teensyduino via PlatformIO and see if that fixes it.

Thanks for looking in to it!
Steve
 
Status
Not open for further replies.
Back
Top