Topic: 'Not enought memory' Arduino
Hi, I'm doing an example exercise for encryption and decryption in Arduino.
#include <wolfssl.h>
#include <wolfssl/wolfcrypt/aes.h>
void setup(void){
}
void loop(void){
Aes enc;
int ret = 0;
byte key[] = {"0123456789abcdef"};
byte iv[] = {"1234567890abcdef"};
String plain = "hola mundo";
if (ret = wc_AesSetKey(&enc, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION) != 0) {
// failed to set aes key
}
}
The trouble is the call to the function 'wc_AesSetKey' produces a 'not enought memory' arduino error.
If I comment function, it gets the message: "Global variables use 35 bytes (1%) of dynamic memory, leaving 2,013 bytes for Local variables Maximum is 2,048 bytes.."
But if the code is complete, I get: "Global variables use 2,137 bytes (104%) of dynamic memory, leaving -89 Maximum bytes for the local variables is 2,048 bytes..
processing.app.debug.RunnerException: Not enough memory; http://www.arduino.cc/en/Guide/Troubleshooting#size see for tips on Reducing your footprint.
at cc.arduino.Compiler.size (Compiler.java:338)
at cc.arduino.Compiler.build (Compiler.java:158)
at processing.app.Sketch.build (Sketch.java:1111)
at processing.app.Sketch.exportApplet (Sketch.java:1146)
at processing.app.Sketch.exportApplet (Sketch.java:1132)
processing.app.Editor at $ DefaultExportHandler.run (Editor.java:2409)
at java.lang.Thread.run (Thread.java:745)
Not enough memory; http://www.arduino.cc/en/Guide/Troubleshooting#size see for tips on Reducing your footprint. "
Any suggestion for fix it? Thanks for your replies in advance.