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");
}