From dc8e7de3adbcb5f3c17316bd29319882b217b038 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Thu, 30 Jun 2016 09:49:45 -0700 Subject: [PATCH] Fix cc2538 examples. (#224) --- examples/apps/cli/Makefile.am | 9 ++++++++- examples/apps/ncp/Makefile.am | 9 ++++++++- examples/platforms/cc2538/alarm.c | 4 ++-- examples/platforms/cc2538/radio.c | 6 ++---- examples/platforms/cc2538/random.c | 2 +- examples/platforms/cc2538/serial.c | 2 +- 6 files changed, 22 insertions(+), 10 deletions(-) diff --git a/examples/apps/cli/Makefile.am b/examples/apps/cli/Makefile.am index edf8d00e6..2c810840b 100644 --- a/examples/apps/cli/Makefile.am +++ b/examples/apps/cli/Makefile.am @@ -41,12 +41,15 @@ ot_cli_LDADD = \ $(top_builddir)/src/core/libopenthread.a \ $(top_builddir)/src/cli/libopenthread-cli.a \ $(top_builddir)/third_party/mbedtls/libmbedcrypto.a \ - -lstdc++ \ + $(NULL) + +ot_cli_LDFLAGS = \ $(NULL) if OPENTHREAD_EXAMPLES_POSIX ot_cli_LDADD += \ $(top_builddir)/examples/platforms/posix/libopenthread-posix.a \ + -lstdc++ \ $(NULL) endif @@ -54,6 +57,10 @@ if OPENTHREAD_EXAMPLES_CC2538 ot_cli_LDADD += \ $(top_builddir)/examples/platforms/cc2538/libopenthread-cc2538.a \ $(NULL) + +ot_cli_LDFLAGS += \ + -T $(top_srcdir)/examples/platforms/cc2538/cc2538.ld \ + $(NULL) endif ot_cli_SOURCES = \ diff --git a/examples/apps/ncp/Makefile.am b/examples/apps/ncp/Makefile.am index 0778b4234..b131d0e5a 100644 --- a/examples/apps/ncp/Makefile.am +++ b/examples/apps/ncp/Makefile.am @@ -41,12 +41,15 @@ ot_ncp_LDADD = \ $(top_builddir)/src/core/libopenthread.a \ $(top_builddir)/src/ncp/libopenthread-ncp.a \ $(top_builddir)/third_party/mbedtls/libmbedcrypto.a \ - -lstdc++ \ + $(NULL) + +ot_ncp_LDFLAGS = \ $(NULL) if OPENTHREAD_EXAMPLES_POSIX ot_ncp_LDADD += \ $(top_builddir)/examples/platforms/posix/libopenthread-posix.a \ + -lstdc++ \ $(NULL) endif @@ -54,6 +57,10 @@ if OPENTHREAD_EXAMPLES_CC2538 ot_ncp_LDADD += \ $(top_builddir)/examples/platforms/cc2538/libopenthread-cc2538.a \ $(NULL) + +ot_ncp_LDFLAGS += \ + -T $(top_srcdir)/examples/platforms/cc2538/cc2538.ld \ + $(NULL) endif ot_ncp_SOURCES = \ diff --git a/examples/platforms/cc2538/alarm.c b/examples/platforms/cc2538/alarm.c index 54441d1bf..acfc73a2d 100644 --- a/examples/platforms/cc2538/alarm.c +++ b/examples/platforms/cc2538/alarm.c @@ -49,7 +49,7 @@ static uint32_t sAlarmT0 = 0; static uint32_t sAlarmDt = 0; static bool sIsRunning = false; -void PlatformAlarmInit(void) +void cc2538AlarmInit(void) { HWREG(NVIC_ST_RELOAD) = kSystemClock / kTicksPerSec; HWREG(NVIC_ST_CTRL) = NVIC_ST_CTRL_CLK_SRC | NVIC_ST_CTRL_INTEN | NVIC_ST_CTRL_ENABLE; @@ -72,7 +72,7 @@ void otPlatAlarmStop(void) sIsRunning = false; } -void PlatformAlarmProcess(void) +void cc2538AlarmProcess(void) { uint32_t expires; bool fire = false; diff --git a/examples/platforms/cc2538/radio.c b/examples/platforms/cc2538/radio.c index a3efa4d60..7d186b221 100644 --- a/examples/platforms/cc2538/radio.c +++ b/examples/platforms/cc2538/radio.c @@ -142,7 +142,7 @@ ThreadError otPlatRadioSetShortAddress(uint16_t address) return kThreadError_None; } -void PlatformRadioInit(void) +void cc2538RadioInit(void) { sTransmitFrame.mLength = 0; sTransmitFrame.mPsdu = sTransmitPsdu; @@ -368,7 +368,7 @@ exit: return; } -int PlatformRadioProcess(void) +void cc2538RadioProcess(void) { readFrame(); @@ -416,8 +416,6 @@ int PlatformRadioProcess(void) { disableReceiver(); } - - return 0; } void RFCoreRxTxIntHandler(void) diff --git a/examples/platforms/cc2538/random.c b/examples/platforms/cc2538/random.c index 3bb018c41..88f4df97f 100644 --- a/examples/platforms/cc2538/random.c +++ b/examples/platforms/cc2538/random.c @@ -39,7 +39,7 @@ static uint32_t s_state = 1; -void PlatformRandomInit(void) +void cc2538RandomInit(void) { // use Extended Identifier portion of IEEE EUI-64 as the seed s_state = HWREG(IEEE_EUI64 + 4); diff --git a/examples/platforms/cc2538/serial.c b/examples/platforms/cc2538/serial.c index edf053efa..38934a231 100644 --- a/examples/platforms/cc2538/serial.c +++ b/examples/platforms/cc2538/serial.c @@ -161,7 +161,7 @@ exit: return; } -void PlatformSerialProcess(void) +void cc2538SerialProcess(void) { processReceive(); processTransmit();