tgx icon indicating copy to clipboard operation
tgx copied to clipboard

Compiling with STM32duino

Open wystewart opened this issue 1 year ago • 2 comments

PC0, PC1, PC2, PC3 defined in Renderer3D.inl conflict with #define pinout definitions of the STM32.

Suggest to change to _PC0, _PC1, _PC2, _PC3. That seems to resolve the compile issue

wystewart avatar Apr 14 '24 16:04 wystewart

i also added this to misc.h. i haven't checked yet if stm32 has a native sqrt implementation.

#if defined(ARDUINO_ARCH_STM32) #include "Arduino.h" #define TGX_ON_ARDUINO #define TGX_USE_FAST_INV_SQRT_TRICK #define TGX_USE_FAST_SQRT_TRICK
#define TGX_USE_FAST_INV_TRICK #endif

and defined(ARDUINO_ARCH_STM32) to the following.

#if defined(TEENSYDUINO) || defined(ESP32) || defined(ARDUINO_ARCH_STM32) // On teensy, 8K give good results... #define TGX_PROGMEM_DEFAULT_CACHE_SIZE 8192 #else // make it bigger on CPU... #define TGX_PROGMEM_DEFAULT_CACHE_SIZE 262144 #endif

STM32 could use a bigger cache than 8192 as it has more memory, but in most applications 262144 will be too big. so for now I'm sticking to 8192.

wystewart avatar Apr 14 '24 17:04 wystewart

Hi,

Thanks for the suggestion !

I implemented the changes so hopefully it helps with STM32Duino compatibility. Beware that the changes have been made on the improved_drawing_primitives branch which has many bug fixes, some speed improvement and a much better 2D drawing API and which will become the master branch 'soon'.

As for the existence of a fast sqrt on STM32, I do not know but I suppose it is very similar to Teensy since it also use ARM Cortex-M cores so I am using the same presets for both.

Best,

vindar avatar Sep 14 '24 21:09 vindar