int fubar(void) {
return random(100);
}
void setup() {
delay(5000);
Serial.begin(115200);
byte i = 7;
char *foo;
Serial.print("sizeof(foo): ");
Serial.println(sizeof(foo));
Serial.println("1111");
foo=(char *)&i;
Serial.print("Addr: ");
Serial.println((unsigned long )foo,HEX);
Serial.print("Value: ");
Serial.println((byte)*foo);
Serial.println("2222");
foo=(char *)&fubar;
Serial.print("Addr: ");
Serial.println((unsigned long )foo,HEX);
Serial.print("Value: ");
Serial.println((byte)*foo); // <-- reboots here
}
void loop() {
delay(1000);
}
ReinholdHiller wrote:I simply want to acces the first byte of the code, but all I get is a reboot.
You can only access IRAM with aligned 4-byte reads/writes, the core does not support bytewise access.
2222
Addr: 40210834
Addr: 1000000001000010000100000110100
Value:
ReinholdHiller wrote:So what to do? My pointer looks aligned to me...2222
Addr: 40210834
Addr: 1000000001000010000100000110100
Value:
Read whole uint32_t words and extract bytes from them.