Problem compiling ulisp 4.5 for arm on teensy 4.1


#1

Hi ,
I’m having trouble to compile the arm 4.5 for a teensy 4.1.
All goes well starting from the version on the website , until I uncomment #define extensions
I’m using the latest arduino 2.1.1 and Pauls Stoffregen 1.85 teensyduino. I asked him today if this works with arduino 2.1.1 and he confirms it does.
When uncommenting the line #define extensions I got this error:

Compilation error: 'tablesize' was not declared in this scope

What could be the problem here ?
It seems that tablesize is generating this fault , however , if using the same file for lets say an rp2040 there’s no error at all.

Kind regards,
Ronny


#3

Fortunately I think the solution is quite simple:

If you uncomment #define extensions you have to have an Extensions File present, as that overrides the definition of tablesize in the main uLisp source.

You could use the example Extensions File described here: Adding your own functions

Or there are a couple of others I’ve developed:

Let me know if that solves the problem. I’ll think about whether I can make the compiler generate a more helpful error message, such as “Missing uLisp Extensions File”!


#4

PS I’ve just noticed that you’re using Arduino IDE 2.1.1. I haven’t tried the Extensions File mechanism with that IDE, so it’s possible that the problem is caused by the Extensions File not being found by the compiler on that IDE.


#5

Hi David,
Thanks for the reply.
Yes it was a bit silly that I forgot to include an .ino file.
I’ve included your neopixels.ino , and with a minor addition of
#define NEOPIXEL_NUM 4
#define PIN_NEOPIXEL 9
I got it working.
But , remember the (directory) you created last week , there still is an issue :

/home/ronny/Arduino/sketch_aug20a/sketch_aug20a.ino: In function ‘int saveimage(object*)’:
/home/ronny/Arduino/sketch_aug20a/sketch_aug20a.ino:953:64: warning: unsigned conversion from ‘int’ to ‘uint8_t’ {aka ‘unsigned char’} changes value from ‘1538’ to ‘2’ [-Woverflow]
953 | file = SD.open(MakeFilename(arg, buffer), O_RDWR | O_CREAT | O_TRUNC);
| ^
/home/ronny/Arduino/sketch_aug20a/sketch_aug20a.ino:957:51: warning: unsigned conversion from ‘int’ to ‘uint8_t’ {aka ‘unsigned char’} changes value from ‘1538’ to ‘2’ [-Woverflow]
957 | file = SD.open("/ULISP.IMG", O_RDWR | O_CREAT | O_TRUNC);
| ^
/home/ronny/Arduino/sketch_aug20a/directory.ino: In function ‘object* fn_directory(object*, object*)’:
/home/ronny/Arduino/sketch_aug20a/directory.ino:7:11: error: no matching function for call to ‘SDClass::begin(int, SPIClass&)’
7 | SD.begin(SDCARD_SS_PIN,SPI1);
| ^~~~~~~~~~~~
In file included from /home/ronny/Arduino/sketch_aug20a/sketch_aug20a.ino:32:
/home/ronny/.arduino15/packages/teensy/hardware/avr/1.58.1/libraries/SD/src/SD.h:180:14: note: candidate: ‘bool SDClass::begin(uint8_t)’
180 | bool begin(uint8_t csPin = 10);
| ^~~~~
/home/ronny/.arduino15/packages/teensy/hardware/avr/1.58.1/libraries/SD/src/SD.h:180:14: note: candidate expects 1 argument, 2 provided
Multiple libraries were found for “SD.h”
Used: /home/ronny/.arduino15/packages/teensy/hardware/avr/1.58.1/libraries/SD
Not used: /home/ronny/.arduino15/libraries/SD
Not used: /home/ronny/Arduino/libraries/SD
Using library SPI at version 1.0 in folder: /home/ronny/.arduino15/packages/teensy/hardware/avr/1.58.1/libraries/SPI
Using library Wire at version 1.0 in folder: /home/ronny/.arduino15/packages/teensy/hardware/avr/1.58.1/libraries/Wire
Using library SD at version 2.0.0 in folder: /home/ronny/.arduino15/packages/teensy/hardware/avr/1.58.1/libraries/SD
Using library SdFat at version 2.1.2 in folder: /home/ronny/.arduino15/packages/teensy/hardware/avr/1.58.1/libraries/SdFat
Using library LittleFS at version 1.0.0 in folder: /home/ronny/.arduino15/packages/teensy/hardware/avr/1.58.1/libraries/LittleFS
exit status 1

Compilation error: no matching function for call to ‘SDClass::begin(int, SPIClass&)’

I will try to upload the directory.ino

Regards,
Ronny


#6

Hi David ,

I found the solution. It looks like the sdcard interface on the teensy 4.1 is on a seperate channel so to say.
(I consulted the schematics)
Therefore in SD.Begin , you can not use spi1 after the CSpin.
SD.begin(SDCARD_SS_PIN); is enough
It compiles ok and I can do (directory)
59999> (directory)
(“sunrise-sunset.fs” “Greeting.txt” “ULISP.IMG” “test.fs”)

59999>

Sorry for bothering you with this.
Most important it’s solved :-)

Kind regards,
Ronny


#7

Great! Thanks for letting me know.


#8