MiniCore icon indicating copy to clipboard operation
MiniCore copied to clipboard

Question: is there a way to get MCU clock type and BOD status from precompiller ?

Open Demonic098 opened this issue 2 years ago • 4 comments

My project is trgeted for specific MCU configuration and can act werdly if configured incorrectly. There is a simple way to get MCU frequency for any core/MCU but i need to check MCU clock type(Internal/external), BOD status and if core is set to Minicore from precompiller. Currently i am using following code:

#if (F_CPU == 8000000UL)
#else 
#error "Set (Clock to 8MHz Internal) (BOD to disabled ) and BURN MiniCore bootloader" 
#error "https://github.com/MCUdude/MiniCore"
#endif

Demonic098 avatar Nov 19 '21 12:11 Demonic098

Update: i've found MINICORE definition.

#if defined (MINICORE) && (F_CPU == 8000000UL)

Demonic098 avatar Nov 19 '21 12:11 Demonic098

There are no macros that can indicate that the fuse bits aren't correct. Bear in mind that the compiler doesn't really know anything about the fuse bits. It's a separate thing that Avrdude takes care of.

I could technically add "defines" for the various settings, but it wouldn't necessarily work well because there's no way to tell the compiler which settings are actually on the microcontroller.

MCUdude avatar Nov 28 '21 19:11 MCUdude

It's not about microcontroller fuse bits. I only care if MINICORE MCU settings are set correctly.

Demonic098 avatar Nov 29 '21 03:11 Demonic098

I only care if MINICORE MCU settings are set correctly.

This is not currently possible.

MCUdude avatar Mar 07 '22 08:03 MCUdude