I am trying to write some really basic code for the ADuCM3029 from ADI.
It all compiles OK, except for the error message:
aducm3029_test.c(90): warning: #223-D: function "SystemCoreClockUpdate" declared implicitly SystemCoreClockUpdate();
I have copied the system_ADuCM3029.c (that contains the SystemCoreClockUpdate function) file into my RTE folder and the compiler has this folder in its include path, so I cannot see what the problem is.
For info, here is the applicable code:
#include <stdint.h> // needed for the int32_t definition //#include <system_ADuCM3029.c> // needed for SystemCoreClockUpdate #include "aducm3029_test.h" /* stick all the header stuff in here */ #include <ADuCM302x.h> /* stores register and bit names */ #include <ADuCM302x_device.h> /* stores pointers to registers */ /*------------------------------------------------------------------*/ /* CLOCK FUNCTIONS */ /*------------------------------------------------------------------*/ void initialise(void) { /* Enable internal HF oscillators */ // disable key protection for clock oscillator pADI_CLKG0_OSC->KEY = 0xCB14u; /* Switch on the internal HF oscillator */ pADI_CLKG0_OSC->CTL |= BITP_CLKG_OSC_CTL_HFOSCEN; /* wait for HF OSC to stabilize */ while ((pADI_CLKG0_OSC->CTL & (1U << BITP_CLKG_OSC_CTL_HFOSCOK)) == 0u) { } /* Miscellaneous Clock Settings */ /* Use internal HF oscillator for PCLK and HCLK */ pADI_CLKG0_CLK->CTL0 &= BITP_CLKG_CLK_CTL0_CLKMUX; /* set CLK control Reg 0 later when you start using peripherals */ /* leave Clock Control Regs 1 and 3 as default settings */ /* configure Clock Control Reg 5 (clock gating for peripherals) when needed. */ /* meanwhile, keep with default values */ /*------------------------------------------------------------------*/ /* POWER MANAGEMENT FUNCTIONS */ /*------------------------------------------------------------------*/ pADI_PMG0->IEN = 0x0000; // disable all interrupts pADI_PMG0->PWRMOD = 0x0000; // keep in active mode pADI_PMG0->CTL1 = 0x0000; // keep buck converter off for the moment /* enable LF crystal oscillator */ pADI_CLKG0_OSC->KEY = 0xCB14u; pADI_CLKG0_OSC->CTL |= BITP_CLKG_OSC_CTL_LFXTALEN; /* wait for LF OSC to stabilize */ while ((pADI_CLKG0_OSC->CTL & (1U << BITP_CLKG_OSC_CTL_LFOSCOK)) == 0u) { } /* set the power management interrupts when needed */ /* compute new internal clocks based on the newly reset controller */ SystemCoreClockUpdate(); return; } int main(void) { }
What am I doing wrong?
If I include system_ADuCM3029.c, I get a stack of 'multiply defined' variable errors
I have written thousands of lines of code for PICs, Atmels, 8051s etc, but am new to the ARM ecosystem.
Please let me know
Thanks
Bill
FIRST IS DON'T INCLUDE THE C FILE!
THEN DO INCLUDE THE PROPER HEADER FILE
THIS IS NOT SPECIFIC TO ARM. IT WILL BE THE SAME FOR ANY SANE DEVELOPMENT ENVIRONMENT
Thanks for replying so quickly. The inclusion of the C file was an act of desperation.
I found the problem - I had not configured the Run Time Environment (RTE) properly.
For those who stumble across this post looking for advice on the same error, here is the solution:
Inside Keil, do Project -> Manage -> Run Time Environment
Check the following boxes: CMSIS -> Core Device -> Examples Support Device -> Global Configuration Device -> Retarget Device -> Startup
Device -> Drivers -> UART
Device -> Services -> DMA Device -> Services -> Power Device -> Services -> WDT
There should then be no messages in the Validation Output box at the bottom of the Run Time Environment Window.
Code works perfectly now. On to the next headache