NUC123: Added CONFIG enabling switch

This commit is contained in:
Alex Lewontin 2021-02-15 11:35:01 -05:00
parent 79f9bc0649
commit c328f805c2
No known key found for this signature in database
GPG Key ID: 0E546139BFD2AA90
4 changed files with 33 additions and 4 deletions

View File

@ -96,6 +96,10 @@
/* Derived constants and error checks. */
/*===========================================================================*/
#if (NUC123_EFL_ACCESS_DATAFLASH == TRUE) && (NUC123_CONFIG_ENABLED == FALSE)
#error "EFL driver data flash access requires NUC123_CONFIG_ENABLED to be set to TRUE"
#endif
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/

View File

@ -50,8 +50,12 @@ uint32_t SystemCoreClock = __HSI; /* System Clock Frequency (Core Clock)*/
uint32_t CyclesPerUs = (__HSI / 1000000); /* Cycles per micro second */
uint32_t PllClock = __HSI; /*!< PLL Clock Frequency */
volatile const uint32_t config0 __attribute__((used, unused, section(".nuc123_config0"))) = NUC123_CONFIG0;
volatile const uint32_t config1 __attribute__((used, unused, section(".nuc123_config1"))) = NUC123_CONFIG1;
#if (NUC123_CONFIG_ENABLED == TRUE)
static volatile const uint32_t config0 __attribute__((used, unused, section(".nuc123_config0"))) = NUC123_CONFIG0;
static volatile const uint32_t config1 __attribute__((used, unused, section(".nuc123_config1"))) = NUC123_CONFIG1;
#endif
/*===========================================================================*/
/* Driver local functions. */

View File

@ -183,6 +183,13 @@
#define NUC123_HCLK 72000000UL
#endif
/**
* @brief Enables the use of the CONFIG0/1 registers
*/
#if !defined(NUC123_CONFIG_ENABLED) || defined(__DOXYGEN__)
#define NUC123_CONFIG_ENABLED FALSE
#endif
/**
* @brief Enables or disables data flash
* @warning If data this is set to @p TRUE, the data flash
@ -191,10 +198,10 @@
* that the combination of the data flash & the text section still fit
* into ROM.
* @note The default is @p FALSE.
* @note The default is @p TRUE.
*/
#if !defined(NUC123_DATAFLASH_ENABLED) || defined(__DOXYGEN__)
#define NUC123_DATAFLASH_ENABLED FALSE
#define NUC123_DATAFLASH_ENABLED TRUE
#endif
/**
@ -237,6 +244,19 @@
/*
* Persistant configuration settings.
*/
#if (NUC123_CONFIG_ENABLED == FALSE)
#if (NUC123_DATAFLASH_ENABLED == FALSE)
#error "Setting NUC123_DATAFLASH_ENABLED to FALSE requires NUC123_CONFIG_ENABLED to be TRUE"
#endif
#if (NUC123_DATAFLASH_SIZE != 4096)
#error "Setting NUC123_DATAFLASH_SIZE to a value other than 4096 requires NUC123_CONFIG_ENABLED to be TRUE"
#endif
#endif
#if (NUC123_DATAFLASH_ENABLED == TRUE)
#if (NUC123_DATAFLASH_SIZE == 4096)

View File

@ -29,6 +29,7 @@
#define NUC123_SERIAL_CLKSRC NUC123_SERIAL_CLKSRC_HSI
#define NUC123_CONFIG_ENABLED TRUE
#define NUC123_DATAFLASH_ENABLED TRUE
#define NUC123_DATAFLASH_SIZE 4096
#define NUC123_EFL_ACCESS_APROM TRUE