I'm trying to build a project that transmits data via xbee in regular interval of time. So for this I used the uart and rtc functions of ev-cog-ad3029lz. This program works fine in debug mode. When trying to build in release mode it gives this error. I want my project work stand-alone without being connected to the pc. What should I do.?
Hi,
Please read this FAQ it will help you on working with stand alone mode.
Regards,
Jeric
Can you check CrossCore GCC ARM Embedded Assembler, CrossCore GCC ARM Embedded C Compiler and CrossCore GCC ARM C++ Compiler settings All options if you have define -mcpu=cortex-m3. If not, define it to…
You have to configure your linker file to put the data on retained RAM region, goto folder name RTE>>device>>aducm3029 and look for aduc3029.ld change both .data and .bss to DSRAM_A
-jeric
this where my program gets stuck in release mode.
Can you share your full project?
This is my project in .rar format
/*! ***************************************************************************** @file: adt7420_app.cpp @brief: ADT7420 temperature sensor demo @details: Example demonstrating the temperature sensor functionality ----------------------------------------------------------------------------- Copyright (c) 2017 Analog Devices, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Modified versions of the software must be conspicuously marked as such. - This software is licensed solely and exclusively for use with processors manufactured by or for Analog Devices, Inc. - This software may not be combined or merged with other code in any manner that would cause the software to become subject to terms and conditions which differ from those listed here. - Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - The use of this software may or may not infringe the patent rights of one or more patent holders. This license does not release you from the requirement that you obtain separate licenses from these patent holders to use this software. THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, TITLE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF CLAIMS OF INTELLECTUAL PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ #include "ADuCM3029_device.h" #include "common.h" #include "system_ADuCM3029.h" #include <drivers/pwr/adi_pwr.h> #include <drivers/rtc/adi_rtc.h> #include <drivers/wdt/adi_wdt.h> #include "adt7420_app.h" #include <common/adi_timestamp.h> #include <drivers/gpio/adi_gpio.h> #include <base_sensor/adi_sensor_errors.h> using namespace adi_sensor_swpack; #define ALARM_OFFSET (4.096) // alarm offset, must be added to rtc alarm counter everytime rtc1 alarm irq is triggered #define ALARM_TIME (15000) // rtc1 will alarm every 250mS static void TempStandaloneMode(Temperature *pTemp); /* Local Functions */ static void InitSystem(void); static void Trap(void); //RTC static uint8_t gpioMemory[ADI_GPIO_MEMORY_SIZE]; static uint32_t bHibernateExitFlag; ADI_RTC_HANDLE hRTC1 = NULL; static uint8_t RTC1Memory[ADI_RTC_MEMORY_SIZE]; void Configure_PwrOpts (void); void Configure_LED5 (void); void Configure_RTC1 (void); void Enter_LowPowerMode (void); void reset_RTC1_cnts (void); /* Callback prototypes */ void rtc1Callback (void *pCBParam, uint32_t Event, void *pArg); /*! * @brief Main * * @details Application entry point. * * @param [in] argc : Number of arguments (unused) * * @param [in] argv : Arguments (unused) * */ int main(int argc, char *argv[]) { ADT7420 adt7420; Temperature *pTemp = &adt7420; SENSOR_RESULT eSensorResult; // configure power and clock options Configure_PwrOpts(); // configure rtc1 (flex rtc) Configure_RTC1(); // configure LED 5 to blink Configure_LED5(); /* Initialize the system */ InitSystem(); /* Open Temperature sensor */ eSensorResult = pTemp->open(); if(eSensorResult != SENSOR_ERROR_NONE) { PRINT_SENSOR_ERROR(DEBUG_MESSAGE, eSensorResult); Trap(); } /* Start measurement */ eSensorResult = pTemp->start(); if(pTemp->start() != SENSOR_ERROR_NONE) { PRINT_SENSOR_ERROR(DEBUG_MESSAGE, eSensorResult); Trap(); } do{ // enter low power mode, code will halt here // will exit when rtc1 alarm irq is triggered Enter_LowPowerMode(); // toggle LED5 // configure LED 5 to blink TempStandaloneMode(pTemp); Configure_LED5(); // reload rtc1 alarm value reset_RTC1_cnts(); }while(1); } /*! * @brief Initializes the system * * @details This function is responsible for initializing the pinmuxing, power service * and bluetooth subsystem. It also initializes the realtime clock for to timestamp * the outgoing sensor data packets. */ static void InitSystem(void) { ADI_PWR_RESULT ePwr; /* Explicitly disable the watchdog timer */ *pREG_WDT0_CTL = 0x0u; /* Pinmux */ adi_initpinmux(); /* Initialize clocks */ ePwr = adi_pwr_Init(); DEBUG_RESULT("Error initializing the power service.\r\n", ePwr, ADI_PWR_SUCCESS); ePwr = adi_pwr_SetClockDivider(ADI_CLOCK_HCLK, 1u); DEBUG_RESULT("Error configuring the core clock.\r\n", ePwr, ADI_PWR_SUCCESS); ePwr = adi_pwr_SetClockDivider(ADI_CLOCK_PCLK, 1u); DEBUG_RESULT("Error configuring the peripheral clock.\r\n", ePwr, ADI_PWR_SUCCESS); common_Init(); #ifdef __EVCOG__ /* Unlike the CUP board, the COG board I2C pins are pulled to a GPIO line instead of VDD */ static uint8_t aGpioMemory[ADI_GPIO_MEMORY_SIZE]; ADI_GPIO_RESULT eGpioResult = adi_gpio_Init(aGpioMemory, sizeof(aGpioMemory)); DEBUG_RESULT("adi_gpio_Init", eGpioResult, ADI_GPIO_SUCCESS); eGpioResult = adi_gpio_OutputEnable(ADI_GPIO_PORT1, ADI_GPIO_PIN_12, true); DEBUG_RESULT("adi_gpio_OutputEnable", eGpioResult, ADI_GPIO_SUCCESS); eGpioResult = adi_gpio_SetHigh(ADI_GPIO_PORT1, ADI_GPIO_PIN_12); DEBUG_RESULT("adi_gpio_SetHigh", eGpioResult, ADI_GPIO_SUCCESS); eGpioResult = adi_gpio_UnInit(); DEBUG_RESULT("adi_gpio_UnInit", eGpioResult, ADI_GPIO_SUCCESS); #endif DEBUG_MESSAGE("Starting ADT7420 temperature demo application\r\n"); /* Init timestamping */ INIT_TIME(); } /*! * @brief Trap function * * @details In case of catastrophic errors this function is called to block * infinitely. */ static void Trap() { while(1); } /*! * @brief Standalone Temperature demo * * @details Standalone mode just prints the x,y,z values to the console. */ static void TempStandaloneMode(Temperature *pTemp) { float nTempCel, nTempFar; SENSOR_RESULT eSensorResult; /* WHILE(forever) */ for(int i =0; i<5;i++) { /* Get temperature in Celsius */ eSensorResult = pTemp->getTemperatureInCelsius(&nTempCel); if(eSensorResult == SENSOR_ERROR_NONE) { DEBUG_MESSAGE("Current temperature: %05.1f C.\r\n", nTempCel); } /* Get temperature in Fahrenheit */ eSensorResult = pTemp->getTemperatureInFahrenheit(&nTempFar); if(eSensorResult == SENSOR_ERROR_NONE) { DEBUG_MESSAGE("Current temperature: %05.1f F.\r\n", nTempFar); } } /* delay */ for(volatile uint32_t i = 0; i < 0xfff; i++); //} /* ENDWHILE */ } void Configure_PwrOpts (void) { adi_pwr_Init(); adi_pwr_EnableClockSource(ADI_CLOCK_SOURCE_LFXTAL,true); adi_pwr_SetClockDivider(ADI_CLOCK_HCLK,1); adi_pwr_SetClockDivider(ADI_CLOCK_PCLK,1); } void Configure_RTC1 (void) { // Initialization functions adi_rtc_Open(1, RTC1Memory, ADI_RTC_MEMORY_SIZE, &hRTC1); adi_rtc_RegisterCallback(hRTC1, rtc1Callback, hRTC1); // register callback for rtc1 irqs // Configuration functions adi_rtc_SetCount(hRTC1, 0); adi_rtc_SetAlarmEx(hRTC1, ALARM_TIME * ALARM_OFFSET); // set fractional alarm value // you can also use adi_rtc_SetAlarm() function for adi_rtc_SetPreScale(hRTC1, 3); // params : rtc handler and the power of 2 prescaler // Code to enable the RTC1 adi_rtc_EnableInterrupts(hRTC1, ADI_RTC_ALARM_INT, true); adi_rtc_EnableAlarm(hRTC1, true); adi_rtc_Enable(hRTC1, true); } void Configure_LED5() { adi_gpio_Init(gpioMemory, ADI_GPIO_MEMORY_SIZE); adi_gpio_OutputEnable(ADI_GPIO_PORT2, ADI_GPIO_PIN_10, true); adi_gpio_SetHigh(ADI_GPIO_PORT2, ADI_GPIO_PIN_10); } void Enter_LowPowerMode (void) { bHibernateExitFlag = false; adi_pwr_EnterLowPowerMode(ADI_PWR_MODE_HIBERNATE, &bHibernateExitFlag, 0); } /* * reloads alarm counter. get the current rtc value then add the alarm offset. * the sum is inserted to the alarm counter which is to be compared with the rtc counter * if match, trigger a rtc1 alarm irq */ void reset_RTC1_cnts() { uint32_t rtcCount = 0; adi_rtc_GetCount(hRTC1, &rtcCount); adi_rtc_SetAlarmEx(hRTC1, rtcCount + (ALARM_TIME * ALARM_OFFSET)); } /* CallBack Handler for RTC1 */ void rtc1Callback (void *pCBParam, uint32_t Event, void *pArg) { if(ADI_RTC_ALARM_INT & Event) { adi_rtc_ClearInterruptStatus(hRTC1,ADI_RTC_ALARM_INT); bHibernateExitFlag = true; adi_pwr_ExitLowPowerMode(&bHibernateExitFlag); } }
This program in debug mode wakes up in every 15 seconds and transmits the data,