RTC api undefine upgrade to 3.x

Discussion to talk about software related topics only.
Post Reply
RebootExpert
Posts: 78
Joined: Fri Oct 09, 2020 2:57 pm

RTC api undefine upgrade to 3.x

Post by RebootExpert »

I take a nano project, try to port from 2.9.5 to 3.3.8. but the RTC api I try to call are undefined.
RTCSetSystemFromRTCTime()
RTCSetRTCfromSystemTime()

how can I fix it?
User avatar
TomNB
Posts: 538
Joined: Tue May 10, 2016 8:22 am

Re: RTC api undefine upgrade to 3.x

Post by TomNB »

I just did a quick search of the header files and see RTCSetSystemFromRTCTime in rtc.h. Are you including that in your project?
RebootExpert
Posts: 78
Joined: Fri Oct 09, 2020 2:57 pm

Re: RTC api undefine upgrade to 3.x

Post by RebootExpert »

Yes I did. i've created a demo project to call the functions. undefined reference to the api also. However the errors are related to config_obj.h in line 1070. I look up that line of code in the file, there's not even a single RTC api function in the header file. I guess my machine is acting up. see the build log for more details.

Code: Select all

#include <predef.h>
#include <stdio.h>
#include <nbrtos.h>
#include <http.h>
#include <init.h>
#include <netinterface.h>
#include <rtc.h>

const char * AppName="demo";

void UserMain(void * pd)
{
    init();
    GetInterfaceBlock()->discovery_server = "discover.netburner.com";
    WaitForActiveNetwork(TICKS_PER_SECOND * 5);   // Wait up to 5 seconds for active network activity 
    StartHttp();

    iprintf("Application %s started\n",AppName );
    while (1)
    {
        RTCSetSystemFromRTCTime();
        RTCSetRTCfromSystemTime();
        OSTimeDly(TICKS_PER_SECOND);
    }
}

build_log.txt
(1 KiB) Downloaded 99 times
User avatar
TomNB
Posts: 538
Joined: Tue May 10, 2016 8:22 am

Re: RTC api undefine upgrade to 3.x

Post by TomNB »

When you did the port, did you create a new, empty project and import only the source code files? You want to avoid importing any eclipse project files from the old release.

There are a lot of examples that use that function. Can you try a new project and build this one:
\nburn\examples\_common\MultiPlatform\RTC-OnChip
User avatar
pbreed
Posts: 1080
Joined: Thu Apr 24, 2008 3:58 pm

Re: RTC api undefine upgrade to 3.x

Post by pbreed »

To get temporarily unstuck while we figure this out...
Might also try
#include <mcf5441x_rtc.h)
int MCF541X_RTCSetTime(struct tm &bts);
int MCF541X_RTCSetSystemFromRTCTime(void);
int MCF541X_RTCSetRTCfromSystemTime(void);

What you did should have worked...
RebootExpert
Posts: 78
Joined: Fri Oct 09, 2020 2:57 pm

Re: RTC api undefine upgrade to 3.x

Post by RebootExpert »

the example build successfully. Thanks Paul. Do you see the same issue in your end? I was about to reinstall the nndk.
User avatar
TomNB
Posts: 538
Joined: Tue May 10, 2016 8:22 am

Re: RTC api undefine upgrade to 3.x

Post by TomNB »

Hey Reboot,

No need to do a reinstall. Going from 2.x to 3.x we realized the external RTC driver varied by customer, so we took it out of the system libs. You can find the function in effs_time.cpp of any example that uses this function. Please check in the examples folder for effs_time.cpp and let me know if yu can't find it.
Post Reply