NUC123: Added CONFIG0/1 settings, and updated linker script
This commit is contained in:
parent
5a5c32fd36
commit
09394a1b1a
|
@ -20,15 +20,15 @@
|
||||||
*/
|
*/
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
flash0 (rx) : org = 0x00000000, len = 64k
|
flash0 (rx) : org = 0x00000000, len = 0x11000 /* APROM */
|
||||||
flash1 (rx) : org = 0x00000000, len = 0
|
flash1 (rx) : org = 0x00000000, len = 0 /* Data flash placeholder */
|
||||||
flash2 (rx) : org = 0x00000000, len = 0
|
flash2 (rx) : org = 0x00100000, len = 0x1000 /* LDROM */
|
||||||
flash3 (rx) : org = 0x00000000, len = 0
|
flash3 (rx) : org = 0x00300000, len = 4 /* Config0 */
|
||||||
flash4 (rx) : org = 0x00000000, len = 0
|
flash4 (rx) : org = 0x00300004, len = 4 /* Config1 */
|
||||||
flash5 (rx) : org = 0x00000000, len = 0
|
flash5 (rx) : org = 0x00000000, len = 0
|
||||||
flash6 (rx) : org = 0x00000000, len = 0
|
flash6 (rx) : org = 0x00000000, len = 0
|
||||||
flash7 (rx) : org = 0x00000000, len = 0
|
flash7 (rx) : org = 0x00000000, len = 0
|
||||||
ram0 (wx) : org = 0x20000000, len = 20k
|
ram0 (wx) : org = 0x20000000, len = 0x5000
|
||||||
ram1 (wx) : org = 0x00000000, len = 0
|
ram1 (wx) : org = 0x00000000, len = 0
|
||||||
ram2 (wx) : org = 0x00000000, len = 0
|
ram2 (wx) : org = 0x00000000, len = 0
|
||||||
ram3 (wx) : org = 0x00000000, len = 0
|
ram3 (wx) : org = 0x00000000, len = 0
|
||||||
|
@ -38,6 +38,22 @@ MEMORY
|
||||||
ram7 (wx) : org = 0x00000000, len = 0
|
ram7 (wx) : org = 0x00000000, len = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
REGION_ALIAS("CONFIG0", flash3);
|
||||||
|
REGION_ALIAS("CONFIG1", flash4);
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.nuc123_config0 : ALIGN(4)
|
||||||
|
{
|
||||||
|
KEEP(*(.nuc123_config0))
|
||||||
|
} > CONFIG0
|
||||||
|
|
||||||
|
.nuc123_config1 : ALIGN(4)
|
||||||
|
{
|
||||||
|
KEEP(*(.nuc123_config1))
|
||||||
|
} > CONFIG1
|
||||||
|
}
|
||||||
|
|
||||||
/* For each data/text section two region are defined, a virtual region
|
/* For each data/text section two region are defined, a virtual region
|
||||||
and a load region (_LMA suffix).*/
|
and a load region (_LMA suffix).*/
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,9 @@ uint32_t SystemCoreClock = __HSI; /* System Clock Frequency (Core Clock)*/
|
||||||
uint32_t CyclesPerUs = (__HSI / 1000000); /* Cycles per micro second */
|
uint32_t CyclesPerUs = (__HSI / 1000000); /* Cycles per micro second */
|
||||||
uint32_t PllClock = __HSI; /*!< PLL Clock Frequency */
|
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;
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver local functions. */
|
/* Driver local functions. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
|
@ -114,6 +114,23 @@
|
||||||
#define NUC123_PLLSRC_HSI (1 << CLK_PLLCON_PLL_SRC_Pos) /**< PLL source is HSI. */
|
#define NUC123_PLLSRC_HSI (1 << CLK_PLLCON_PLL_SRC_Pos) /**< PLL source is HSI. */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name User config bit definitions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define NUC123_CONFIG0_DFEN_Pos 0
|
||||||
|
#define NUC123_CONFIG0_DFEN_Msk (1 << NUC123_CONFIG0_DFEN_Pos)
|
||||||
|
|
||||||
|
#define NUC123_CONFIG0_LOCK_Pos 1
|
||||||
|
#define NUC123_CONFIG0_LOCK_Msk (1 << NUC123_CONFIG0_LOCK_Pos)
|
||||||
|
|
||||||
|
#define NUC123_CONFIG0_DFVSEN_Pos 2
|
||||||
|
#define NUC123_CONFIG0_DFVSEN_Msk (1 << NUC123_CONFIG0_DFVSEN_Pos)
|
||||||
|
|
||||||
|
#define NUC123_CONFIG0_CGPFMFP_Pos 27
|
||||||
|
#define NUC123_CONFIG0_CGPFMFP_Msk (1 << NUC123_CONFIG0_CGPFMFP_Pos)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver pre-compile time settings. */
|
/* Driver pre-compile time settings. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -159,11 +176,26 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Clock source for the PLL.
|
* @brief Core clock speed.
|
||||||
*/
|
*/
|
||||||
#if !defined(NUC123_HCLK) || defined(__DOXYGEN__)
|
#if !defined(NUC123_HCLK) || defined(__DOXYGEN__)
|
||||||
#define NUC123_HCLK 72000000UL
|
#define NUC123_HCLK 72000000UL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables or disables data flash
|
||||||
|
*/
|
||||||
|
#if !defined(NUC123_DATAFLASH_ENABLED) || defined(__DOXYGEN__)
|
||||||
|
#define NUC123_DATAFLASH_ENABLED FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the data flash size. This is ignored if data flash is disabled.
|
||||||
|
*/
|
||||||
|
#if !defined(NUC123_DATAFLASH_SIZE) || defined(__DOXYGEN__)
|
||||||
|
#define NUC123_DATAFLASH_SIZE 4096
|
||||||
|
#endif
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -187,10 +219,39 @@
|
||||||
#elif (NUC123_HSECLK < NUC123_HSECLK_MIN) || (NUC123_HSECLK > NUC123_HSECLK_MAX)
|
#elif (NUC123_HSECLK < NUC123_HSECLK_MIN) || (NUC123_HSECLK > NUC123_HSECLK_MAX)
|
||||||
#error "NUC123_HSECLK outside acceptable range (NUC123_HSECLK_MIN...NUC123_HSECLK_MAX)"
|
#error "NUC123_HSECLK outside acceptable range (NUC123_HSECLK_MIN...NUC123_HSECLK_MAX)"
|
||||||
#endif
|
#endif
|
||||||
|
#define NUC123_CONFIG0_HSE_PINS 0
|
||||||
|
#else
|
||||||
|
#define NUC123_CONFIG0_HSE_PINS NUC123_CONFIG0_CGPFMFP_Msk
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NUC123_PLLCLK (NUC123_HCLK * 2)
|
#define NUC123_PLLCLK (NUC123_HCLK * 2)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Persistant configuration settings.
|
||||||
|
*/
|
||||||
|
#if NUC123_DATAFLASH_ENABLE
|
||||||
|
|
||||||
|
#if (NUC123_DATAFLASH_SIZE == 4096)
|
||||||
|
/* DFVSEN = 1, nothing else matters */
|
||||||
|
#define NUC123_CONFIG0_DATAFLASH 0UL
|
||||||
|
/* NUC123_DFBADDR doesn't actually control anything here, but convenient for flash drivers
|
||||||
|
which need the starting address */
|
||||||
|
#define NUC123_DFBADDR 0x1F000UL
|
||||||
|
#else
|
||||||
|
/* DFVSEN = 0, DFEN = 0 */
|
||||||
|
#define NUC123_CONFIG0_DATAFLASH (NUC123_CONFIG0_DFVSEN_Msk | NUC123_CONFIG0_DFEN_Msk)
|
||||||
|
#define NUC123_DFBADDR ((0x11000UL - NUC123_DATAFLASH_SIZE) & ~(0xFFUL))
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
/* DFVSEN = 0, DFEN = 1 */
|
||||||
|
#define NUC123_CONFIG0_DATAFLASH NUC123_CONFIG0_DFVSEN_Msk
|
||||||
|
#define NUC123_DFBADDR 0xFFFFFF00UL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define NUC123_CONFIG0 \
|
||||||
|
0xFFFFFFFFUL & (~NUC123_CONFIG0_DATAFLASH) & (~NUC123_CONFIG0_HSE_PINS)
|
||||||
|
#define NUC123_CONFIG1 NUC123_DFBADDR
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver data structures and types. */
|
/* Driver data structures and types. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -198,6 +259,7 @@
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver macros. */
|
/* Driver macros. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
/* Alias for compatibility */
|
/* Alias for compatibility */
|
||||||
#define SystemUnlockReg() UNLOCKREG()
|
#define SystemUnlockReg() UNLOCKREG()
|
||||||
|
|
||||||
|
|
|
@ -196,4 +196,4 @@ connect:
|
||||||
openocd -f ../scripts/interface/nulink.cfg -f ../scripts/target/numicroM0.cfg
|
openocd -f ../scripts/interface/nulink.cfg -f ../scripts/target/numicroM0.cfg
|
||||||
|
|
||||||
flash: $(BUILDDIR)/$(PROJECT).elf
|
flash: $(BUILDDIR)/$(PROJECT).elf
|
||||||
openocd -f ../scripts/interface/nulink.cfg -f ../scripts/target/numicroM0.cfg -c "program $< verify reset exit"
|
openocd -f ../scripts/interface/nulink.cfg -f ../scripts/target/numicroM0.cfg -c "program $< reset exit"
|
||||||
|
|
|
@ -196,7 +196,7 @@ connect:
|
||||||
openocd -f ../scripts/interface/nulink.cfg -f ../scripts/target/numicroM0.cfg
|
openocd -f ../scripts/interface/nulink.cfg -f ../scripts/target/numicroM0.cfg
|
||||||
|
|
||||||
flash: $(BUILDDIR)/$(PROJECT).elf
|
flash: $(BUILDDIR)/$(PROJECT).elf
|
||||||
openocd -f ../scripts/interface/nulink.cfg -f ../scripts/target/numicroM0.cfg -c "program $< verify reset exit"
|
openocd -f ../scripts/interface/nulink.cfg -f ../scripts/target/numicroM0.cfg -c "program $< reset exit"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Custom rules
|
# Custom rules
|
||||||
|
|
|
@ -193,4 +193,4 @@ connect:
|
||||||
openocd -f ../scripts/interface/nulink.cfg -f ../scripts/target/numicroM0.cfg
|
openocd -f ../scripts/interface/nulink.cfg -f ../scripts/target/numicroM0.cfg
|
||||||
|
|
||||||
flash: $(BUILDDIR)/$(PROJECT).elf
|
flash: $(BUILDDIR)/$(PROJECT).elf
|
||||||
openocd -f ../scripts/interface/nulink.cfg -f ../scripts/target/numicroM0.cfg -c "program $< verify reset exit"
|
openocd -f ../scripts/interface/nulink.cfg -f ../scripts/target/numicroM0.cfg -c "program $< reset exit"
|
||||||
|
|
|
@ -197,7 +197,7 @@ connect:
|
||||||
openocd -f ../scripts/interface/nulink.cfg -f ../scripts/target/numicroM0.cfg
|
openocd -f ../scripts/interface/nulink.cfg -f ../scripts/target/numicroM0.cfg
|
||||||
|
|
||||||
flash: $(BUILDDIR)/$(PROJECT).elf
|
flash: $(BUILDDIR)/$(PROJECT).elf
|
||||||
openocd -f ../scripts/interface/nulink.cfg -f ../scripts/target/numicroM0.cfg -c "program $< verify reset exit"
|
openocd -f ../scripts/interface/nulink.cfg -f ../scripts/target/numicroM0.cfg -c "program $< reset exit"
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue