The "awgrover/buffer1" library does not work

When trying to simulate or fill in the Arduino, it gives an error: Generating C++ code for simulation…
Building…
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:995:9: error: unknown type name ‘byte’
byte *buffer;
^
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:1106:9: error: use of undeclared identifier ‘DEBUG_SERIAL’
DEBUG_SERIAL.print(F(“buffer1/buffer1 tried to allocate 0 bytes\n”)); // exception
^
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:1269:9: error: use of undeclared identifier ‘DEBUG_SERIAL’
DEBUG_SERIAL.print(F(“buffer1/”));DEBUG_SERIAL.print(F(“fill”)); DEBUG_SERIAL.print(F(" saw unallocated buffer1\n")); // exception
^
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:1269:43: error: use of undeclared identifier ‘DEBUG_SERIAL’
DEBUG_SERIAL.print(F(“buffer1/”));DEBUG_SERIAL.print(F(“fill”)); DEBUG_SERIAL.print(F(" saw unallocated buffer1\n")); // exception
^
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:1269:74: error: use of undeclared identifier ‘DEBUG_SERIAL’
DEBUG_SERIAL.print(F(“buffer1/”));DEBUG_SERIAL.print(F(“fill”)); DEBUG_SERIAL.print(F(" saw unallocated buffer1\n")); // exception
^
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:2372:9: error: use of undeclared identifier ‘DEBUG_SERIAL’
DEBUG_SERIAL.print(F(“buffer1/”));DEBUG_SERIAL.print(F(“get-word”)); DEBUG_SERIAL.print(F(" saw unallocated buffer1\n")); // exception
^
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:2372:43: error: use of undeclared identifier ‘DEBUG_SERIAL’
DEBUG_SERIAL.print(F(“buffer1/”));DEBUG_SERIAL.print(F(“get-word”)); DEBUG_SERIAL.print(F(" saw unallocated buffer1\n")); // exception
^
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:2372:78: error: use of undeclared identifier ‘DEBUG_SERIAL’
DEBUG_SERIAL.print(F(“buffer1/”));DEBUG_SERIAL.print(F(“get-word”)); DEBUG_SERIAL.print(F(" saw unallocated buffer1\n")); // exception
^
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:2853:9: error: use of undeclared identifier ‘DEBUG_SERIAL’
DEBUG_SERIAL.print(F(“buffer1/”));DEBUG_SERIAL.print(F(“set-word”)); DEBUG_SERIAL.print(F(" saw unallocated buffer1\n")); // exception
^
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:2853:43: error: use of undeclared identifier ‘DEBUG_SERIAL’
DEBUG_SERIAL.print(F(“buffer1/”));DEBUG_SERIAL.print(F(“set-word”)); DEBUG_SERIAL.print(F(" saw unallocated buffer1\n")); // exception
^
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:2853:78: error: use of undeclared identifier ‘DEBUG_SERIAL’
DEBUG_SERIAL.print(F(“buffer1/”));DEBUG_SERIAL.print(F(“set-word”)); DEBUG_SERIAL.print(F(" saw unallocated buffer1\n")); // exception
^
11 errors generated.
shared:ERROR: ‘/ws/arduino_data/packages/xod/tools/emscripten/1.39.2/bin/clang++ -target wasm32-unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=39 -D__EMSCRIPTEN_tiny__=1 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -nostdsysteminc -Xclang -isystem/ws/arduino_data/packages/xod/tools/emscripten/1.39.2/emscripten/system/include/libcxx -Xclang -isystem/ws/arduino_data/packages/xod/tools/emscripten/1.39.2/emscripten/system/lib/libcxxabi/include -Xclang -isystem/ws/arduino_data/packages/xod/tools/emscripten/1.39.2/emscripten/system/include/compat -Xclang -isystem/ws/arduino_data/packages/xod/tools/emscripten/1.39.2/emscripten/system/include -Xclang -isystem/ws/arduino_data/packages/xod/tools/emscripten/1.39.2/emscripten/system/include/libc -Xclang -isystem/ws/arduino_data/packages/xod/tools/emscripten/1.39.2/emscripten/system/lib/libc/musl/arch/emscripten -Xclang -isystem/ws/arduino_data/packages/xod/tools/emscripten/1.39.2/emscripten/system/local/include -DLLVM_ROOT=/ws/arduino_data/packages/xod/tools/emscripten/1.39.2/bin -DARDUINO_WASM_SIMULATION -DARDUINO_ARCH_WASM -O2 -std=c++11 -nostdlib -fno-exceptions -fno-rtti -c -I/tmp/arduino-sketch-13D110D66947A2AF222576651E78202F/sketch -I/ws/arduino_data/packages/xod/hardware/wasm/0.3.2/cores/simulation -I/ws/arduino_data/packages/xod/hardware/wasm/0.3.2/variants/simulation -DEMSCRIPTEN /tmp/arduino-sketch-13D110D66947A2AF222576651E78202F/sketch/sketch.ino.cpp -Xclang -isystem/ws/arduino_data/packages/xod/tools/emscripten/1.39.2/emscripten/system/include/SDL -c -o /tmp/arduino-sketch-13D110D66947A2AF222576651E78202F/preproc/ctags_target_for_gcc_minus_e.cpp -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr’ failed (1)
Error during build: exit status 1

The generated C++ code contains errors. It can be due to a bad node implementation
or if your board is not compatible with XOD runtime code. The original compiler error
message is above. Fix C++ errors to continue. If you believe it is a bug, report the
problem to XOD developers.

Which board are you compiling for? Can you provide minimal code that can reproduce the error?

To begin with, I ran the examples that are in the library. It threw the same error…Next, I tried simple algorithms, initialized an array of 3 characters, wrote down a number for the indicated number “i”, and then from this array I output my number to “watch”. The same error also appeared.

Friend @gweimer, I’m trying to use nth-input as an array of data nodes, it used to solve my problems. The problem is only in memory optimization, because I am making a project for atduino nano with output to oled (ssd1306). Please tell me how to display information about the remaining memory during the setup process, and how to do it? Also, will the replacement of number type data with byte type data (the range from 0 to 255 is enough for me) give an optimization effect? Thanks in advance!

Looks like nth-input only exists for number & string; my guess would be byte input would use number. Oddly enough, when I create an nth-input node with tweak-byte connected to X0, it compiles fine. If I connect a tweak-number, it complains about conflicting specializations & wants me to explicitly use nth-input(number)

After uploading code, the Compiler tab will show memory used/free for code and variables.

Uploading nth-input with tweak-byte and 35 inputs, I get
Sketch uses 8422 bytes (17%) of program storage space. Maximum is 48640 bytes.
Global variables use 248 bytes (4%) of dynamic memory, leaving 5896 bytes for local variables. Maximum is 6144 bytes.

Uploading nth-input(number) with 35 inputs, I get
Sketch uses 9868 bytes (20%) of program storage space. Maximum is 48640 bytes.
Global variables use 360 bytes (5%) of dynamic memory, leaving 5784 bytes for local variables. Maximum is 6144 bytes.

So byte input actually does use less memory.

1 Like

Dear @gweimer, you must be tired of me, but you always give valuable advice. So the question is again about the nth input node, which is based on the if-else node. Would it be possible to achieve even more optimization if the variables are not initialized as auto but as uint8_t?

My guess would be that auto is converted to the appropriate data type before handing off to the compiler, hence the difference in variable space used when I tried nth-input with byte & number inputs above. The XOD developers put quite a bit of work into optimizing the code they hand off to the compiler.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.