Skip to content

Instantly share code, notes, and snippets.

@jameszah
Created January 1, 2025 21:31
strange compiler error problem -- insn does not satisfy its constraints
strange compiler error problem -- insn does not satisfy its constraints
this code worked on esp32 board libary 2.??? Arduino 1.8.19
but not on esp32 board library 3.04 Arduino 1.8.19
https://github.com/jameszah/ESP32-CAM-JAMCAM/tree/main/jamcamf68
... Innocuous function call inside an object
both(snakeBXY[k][0], snakeBXY[k][1], snakeB_random_green * factor, snakeB_random_red * factor, snakeB_random_blue * factor, snakeB_random_green * 2, snakeB_random_red * 2, snakeB_random_blue * 2);
... which called this function
~~~~~~
void both ( int x, int y, unsigned char g, unsigned char r, unsigned char b, unsigned char g2, unsigned char r2, unsigned char b2 ) {
int row = (y % disheight);
int col = ((row & 1) == 0) ? diswidth - 1 - (x % diswidth) : x % diswidth;
int sample = row * diswidth + col;
#ifndef FASTLED
gfx.setLED (sample, g, r, b);
#else
leds[sample] = CRGB (r, g, b);
#endif
if ( b == 0 && g == 0 && r == 0 ) {
Out[x][y][0] = 255;
Out[x][y][1] = 255;
Out[x][y][2] = 255;
} else {
Out[x][y][0] = b2;
Out[x][y][1] = g2;
Out[x][y][2] = r2;
}
}
~~~~~~
... i tried pulling out all the calculations ...
unsigned char g = snakeB_random_green * factor;
unsigned char r = snakeB_random_red * factor;
unsigned char b = snakeB_random_blue * factor;
unsigned char g2 = snakeB_random_green * 2;
unsigned char r2 = snakeB_random_red * 2;
unsigned char b2 = snakeB_random_blue * 2;
int x = snakeBXY[k][0];
int y = snakeBXY[k][1];
both (x, y, g , r, b, g2, r2, b2);
... which did not help
~~~~
... then copied the code inside the function and it works
unsigned char g = snakeB_random_green * factor;
unsigned char r = snakeB_random_red * factor;
unsigned char b = snakeB_random_blue * factor;
unsigned char g2 = snakeB_random_green * 2;
unsigned char r2 = snakeB_random_red * 2;
unsigned char b2 = snakeB_random_blue * 2;
int x = snakeBXY[k][0];
int y = snakeBXY[k][1];
int row = (y % disheight);
int col = ((row & 1) == 0) ? diswidth - 1 - (x % diswidth) : x % diswidth;
int sample = row * diswidth + col;
#ifndef FASTLED
gfx.setLED (sample, g, r, b);
#else
leds[sample] = CRGB (r, g, b);
#endif
if ( b == 0 && g == 0 && r == 0 ) {
Out[x][y][0] = 255;
Out[x][y][1] = 255;
Out[x][y][2] = 255;
} else {
Out[x][y][0] = b2;
Out[x][y][1] = g2;
Out[x][y][2] = r2;
}
... something about the function call is creating the "insn does not satisfy its constraints" problem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment