Migrating from ATmega to STM32

If you were using ATmega for your projects and want to move to STM32 family, your codes may give lots of error.

At this post, I’ll try to collect all errors I got and solutions of them.


EEPROM

... fatal error: avr/eeprom.h: No such file or directory


ResolveLibrary(avr/eeprom.h) #include <avr/eeprom.h>

Go to mentioned file and and change that line with:

//#include <avr/eeprom.h>
#include <EEPROM.h>


“_BV” redefination warning

This is just a warning but I don’t like warnings too, so let’s fix it

... warning: "_BV" redefined [enabled by default]

#define _BV(x) (1<<(x))

Go to mentioned file and change that line with below 3 lines.

#if !defined(_BV)
	#define _BV(x) (1<<(x))
#endif

If you have another redefination warning you can wrap like below

#if !defined(DEFINATION)
	#define DEFINATION....
#endif


va_list

... error: 'va_list' was not declared in this scope

va_list ....;
· electronic, arduino