void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, STM32!");
}
int divide_by_zero(void)
{
int a = 1;
int c = 0;
int b = a/c;
return b; // forces compiler to actually run this
}
uint32_t unaligned_access(void)
{
uint8_t buffer[6] = {0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF};
uint8_t i = 1;
uint32_t val_BB_to_EE = *((uint32_t *)( &buffer[i] ));
return val_BB_to_EE;
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
Serial.println("Divide by zero");
divide_by_zero();
Serial.println("Before fault");
unaligned_access();
Serial.println("After");
}
nucleo:D1
nucleo:D0
nucleo:RST.1
nucleo:GND.1
nucleo:D2
nucleo:D3
nucleo:D4
nucleo:D5
nucleo:D6
nucleo:D7
nucleo:D8
nucleo:D9
nucleo:D10
nucleo:D11
nucleo:D12
nucleo:VIN
nucleo:GND.2
nucleo:RST.2
nucleo:5V
nucleo:A7
nucleo:A6
nucleo:A5
nucleo:A4
nucleo:A3
nucleo:A2
nucleo:A1
nucleo:A0
nucleo:REF
nucleo:3V3
nucleo:D13