Add compiler_support.h (#25274)
				
					
				
			This commit is contained in:
		
							parent
							
								
									fa24b0fcce
								
							
						
					
					
						commit
						955809bd5a
					
				
					 36 changed files with 142 additions and 81 deletions
				
			
		| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
// Copyright 2024 Nick Brassel (@tzarc)
 | 
			
		||||
// SPDX-License-Identifier: GPL-2.0-or-later
 | 
			
		||||
 | 
			
		||||
#include "compiler_support.h"
 | 
			
		||||
#include "keycodes.h"
 | 
			
		||||
#include "eeprom.h"
 | 
			
		||||
#include "dynamic_keymap.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -25,10 +26,10 @@
 | 
			
		|||
#    define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR (TOTAL_EEPROM_BYTE_COUNT - 1)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
_Static_assert(DYNAMIC_KEYMAP_EEPROM_MAX_ADDR <= (TOTAL_EEPROM_BYTE_COUNT - 1), "DYNAMIC_KEYMAP_EEPROM_MAX_ADDR is configured to use more space than what is available for the selected EEPROM driver");
 | 
			
		||||
STATIC_ASSERT(DYNAMIC_KEYMAP_EEPROM_MAX_ADDR <= (TOTAL_EEPROM_BYTE_COUNT - 1), "DYNAMIC_KEYMAP_EEPROM_MAX_ADDR is configured to use more space than what is available for the selected EEPROM driver");
 | 
			
		||||
 | 
			
		||||
// Due to usage of uint16_t check for max 65535
 | 
			
		||||
_Static_assert(DYNAMIC_KEYMAP_EEPROM_MAX_ADDR <= 65535, "DYNAMIC_KEYMAP_EEPROM_MAX_ADDR must be less than 65536");
 | 
			
		||||
STATIC_ASSERT(DYNAMIC_KEYMAP_EEPROM_MAX_ADDR <= 65535, "DYNAMIC_KEYMAP_EEPROM_MAX_ADDR must be less than 65536");
 | 
			
		||||
 | 
			
		||||
// If DYNAMIC_KEYMAP_EEPROM_ADDR not explicitly defined in config.h,
 | 
			
		||||
#ifndef DYNAMIC_KEYMAP_EEPROM_ADDR
 | 
			
		||||
| 
						 | 
				
			
			@ -56,7 +57,7 @@ _Static_assert(DYNAMIC_KEYMAP_EEPROM_MAX_ADDR <= 65535, "DYNAMIC_KEYMAP_EEPROM_M
 | 
			
		|||
// The keyboard should override DYNAMIC_KEYMAP_LAYER_COUNT to reduce it,
 | 
			
		||||
// or DYNAMIC_KEYMAP_EEPROM_MAX_ADDR to increase it, *only if* the microcontroller has
 | 
			
		||||
// more than the default.
 | 
			
		||||
_Static_assert((DYNAMIC_KEYMAP_EEPROM_MAX_ADDR) - (DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR) >= 100, "Dynamic keymaps are configured to use more EEPROM than is available.");
 | 
			
		||||
STATIC_ASSERT((DYNAMIC_KEYMAP_EEPROM_MAX_ADDR) - (DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR) >= 100, "Dynamic keymaps are configured to use more EEPROM than is available.");
 | 
			
		||||
 | 
			
		||||
#ifndef TOTAL_EEPROM_BYTE_COUNT
 | 
			
		||||
#    error Unknown total EEPROM size. Cannot derive maximum for dynamic keymaps.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue