Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Overview
CoAP Simple Management Protocol (CSMP) is a device lifecycle management protocol optimized for resource constrained devices deployed within large-scale, bandwidth constrained IoT networks.

There are multiple target platforms supported by using OSAL (Operating System Abstraction Layer). The repository provides Linux, FreeRTOS and Silicon Labs EFR32 Wi-SUN device support. FreeRTOS initialised as a submodule and it is built with POSIX port. You can find details about Silicon Labs EFR32 Wi-SUN technology and products on [silabs.com](https://www.silabs.com/wireless/wi-sun).
There are multiple target platforms supported by using OSAL (Operating System Abstraction Layer). The repository provides Linux, FreeRTOS, Silicon Labs EFR32 Wi-SUN and Renesas Wi-SUN FAN device support. FreeRTOS initialised as a submodule and it is built with POSIX port. You can find details about Silicon Labs EFR32 Wi-SUN technology and products on [silabs.com](https://www.silabs.com/wireless/wi-sun). You can find details about the Renesas Wi-SUN FAN integration in the corresponding [Readme](Vendors/Renesas/Readme.md).

These instructions describe the build/run process for a C implementation of a sample CSMP Agent which incorporates the Cisco CSMP library `csmp-agent-lib`.

Expand Down Expand Up @@ -43,7 +43,9 @@ The demonstration requires using a Silicon Labs Wi-SUN Linux Border Router plus

Demonstration setup and detailed configuration can be found under the [/Vendors/Silabs/](/Vendors/Silabs/Readme.md) folder.

#### Renesas - Wi-SUN FAN Platforms

For Renesas Wi-SUN FAN platforms, general information about the integration, supported platforms, requirements, dependencies and configurations can be found under the [/Vendors/Renesas/](Vendors/Renesas/Readme.md) folder.

### Clean
If you want to clean the build files prior to a subsequent build ...
Expand Down
101 changes: 101 additions & 0 deletions Vendors/Renesas/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Renesas Wi-SUN FAN CSMP Agent Integration

<p align="left">
<img src="resources/renesas-logo.jpg" alt="Renesas logo" width="220">
</p>

## Summary

The integration targets Renesas Wi-SUN FAN products based on the Renesas RX and RA MCU families.
Renesas provides Wi-SUN FAN-compliant Sub-GHz solutions for Wi-SUN FAN applications.
For the list of officially supported devices, stack versions, configuration options, and available features, please refer to the Renesas Wi-SUN FAN product and software documentation.

The purpose of this integration is to enable a Renesas Wi-SUN FAN node to communicate with Cisco Field Network Director (FND) using CSMP.
It provides platform-specific functionality required by the CSMP Agent Library, including:

- UDP/IPv6 communication over the Renesas Wi-SUN FAN protocol stack,
- access to platform, stack, and firmware information,
- mapping of Wi-SUN FAN network and firmware information to CSMP TLV objects,
- firmware update integration.

## Requirements

The following components are required to build and run the Renesas Wi-SUN FAN CSMP Agent integration:

- A running instance of Cisco Field Network Director (FND). For a development setup, please refer to the [CSMP Developer Tutorial](../../docs/CSMP%20Developer%20Tutorial%20-%200v11.pdf).

- At least two [Renesas Wi-SUN FAN Development Kits](https://www.renesas.com/en/design-resources/boards-kits/rtk0ee0013d10002bj).

- The latest Renesas [Wi-SUN FAN Protocol Stack](https://www.renesas.com/en/software-tool/sub-ghzwi-sun-protocol-stack). The proprietary Renesas Protocol Stack release already includes the CSMP integration for the Renesas Wi-SUN FAN sample application.

- The proprietary Renesas CC-RX compiler toolchain for RX MCUs.

The Renesas integration is intended to be built with the CC-RX toolchain for RX MCUs and with GCC ARM Embedded for RA MCUs. For both RX and RA MCU families, corresponding project configurations are delivered with the Renesas Wi-SUN FAN Protocol Stack.

## Renesas Wi-SUN FAN Stack

This Renesas CSMP integration layer is designed to be used in conjunction with the latest version of the [Renesas Wi-SUN FAN Protocol Stack](https://www.renesas.com/en/software-tool/sub-ghzwi-sun-protocol-stack).
Different versions may not work, so please make sure that this CSMP integration layer is used with the correct version of the Renesas Wi-SUN FAN Protocol Stack!

Further information about the CSMP usage with the Renesas Wi-SUN FAN protocol stack, APIs, configuration, sample applications, and supported platforms is provided in the user manual of the Renesas Wi-SUN FAN Protocol Stack and accompanying documentation, which are located in the release package of the Renesas Wi-SUN FAN Protocol Stack.
It also includes instructions for configuring and running a sample setup for CSMP with Renesas Wi-SUN FAN nodes.

A project configuration including the CSMP integration is provided in the Renesas Wi-SUN FAN Protocol Stack release package.

## Renesas Library Usage

The Renesas integration uses the following functions from the Renesas Protocol Stack. Further details are provided by the Renesas Wi-SUN FAN Protocol Stack user manual.

| Function or macro | Used by | Purpose |
| --- | --- |---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `R_UDP_DataRequest` | `osal_sendto` | Sends CSMP UDP/IPv6 payloads through the Renesas Wi-SUN FAN network stack. |
| `R_Timer_StartSecs` | `osal_trickle_timer_start`, `R_TrickleTimer_HandleExpired` | Starts or restarts the Renesas timer used by CSMP trickle timers. |
| `R_Timer_Stop` | `osal_trickle_timer_stop` | Stops a Renesas timer backing a CSMP trickle timer. |
| `R_CLOCK_GetUnixTimestamp` | `osal_gettime` | Reads the current Unix timestamp from the Renesas clock service. |
| `R_CLOCK_SetUnixTimestampReference` | `osal_settime`, `currenttime_post` | Updates the Renesas clock reference from a CSMP Current Time TLV. |
| `R_IPv6_IsUnspecified` | `R_CSMP_Start` | Rejects an unspecified FND IPv6 address before starting CSMP. |
| `R_IPv6_IsMulticast` | `R_CSMP_Start` | Rejects a multicast FND IPv6 address before starting CSMP. |
| `R_NWK_GetRequest` | `ipaddress_get`, `iproute_get`, `interface_metrics_get`, `iproute_rplmetrics_get`, `wpanstatus_get`, `rplinstance_get` | Reads Wi-SUN FAN stack attributes such as IPv6 addresses, parent addresses, PHY data rate, interface counters, PAN ID, RPL data, PAN size, and transmit power. |
| `R_NWK_GetRequestMultipart` | `fillIpRouteRplMetric`, `wpanstatus_get` | Iterates through multipart Renesas network data, especially the neighbor cache used for RPL metrics. |
| `R_APP_GetAppName` | `hardware_desc_get` | Supplies the running application name for the CSMP hardware/software description. |
| `R_APP_GetHardwareName` | `hardware_desc_get` | Supplies the Renesas hardware or board name for the CSMP model description. |
| `R_APP_GetNetworkName` | `wpanstatus_get` | Supplies the Wi-SUN FAN network name for the CSMP WPAN status SSID field. |
| `AppIpGetMacAddr` | `hardware_desc_get`, `interface_desc_get`, `ipaddress_get` | Supplies the local EUI-64/MAC address used for serial number, OUI, interface address, and link-local IPv6 address fields. |
| `R_APP_FWUP_TransferRequest` | `transferRequest_post` | Initializes a firmware transfer in the Renesas firmware update module. |
| `R_APP_FWUP_BlockRequest` | `imageBlock_post` | Writes a firmware image block into the Renesas firmware update upload area. |
| `R_APP_FWUP_LoadRequest` | `loadRequest_post` | Schedules the uploaded firmware image for loading at the requested time. |
| `R_APP_FWUP_CancelRequest` | `cancelLoadRequest_post` | Cancels a pending firmware load request. |
| `R_FWUP_SoftwareReset` | `rebootRequest_post` | Performs a software reset when CSMP requests a reboot. |
| `R_Flash_Read` | `initialize_file_hash`, `initialize_file_name`, `initialize_file_size` | Reads firmware metadata stored in Renesas data flash. |
| `r_fwup_wrap_flash_read` | `initialize_file_hash` | Reads the running firmware header from the Renesas firmware update flash wrapper when no stored firmware hash is available. |
| `R_memcpy` | OSAL startup and TLV helpers | Copies Renesas address, EUI-64, firmware metadata, and TLV data using Renesas memory utilities. |
| `MEMZERO_S`, `MEMZERO_A`, `MEMCPY_S`, `MEMCPY_A`, `MEMISZERO_A`, `MEMISNOTZERO_S` | TLV helper functions | Clears/copies/tests TLV structures and Renesas values with the Renesas memory helper macros. |
| `my_alloc`, `my_free` | `osal_malloc`, `osal_free` | Allocates/frees CSMP memory from the heap. |
| `clock_seconds` | Trickle timer logic, uptime, and metrics | Reads the Renesas uptime counter used by CSMP timers and uptime-related TLVs. |
| `random32` | Trickle timer logic | Generates randomized trickle timer offsets. |
| `R_LOG_DBG`, `R_LOG_WARN`, `R_LOG_ERR` | OSAL and TLV helper functions | Emits Renesas logging messages for CSMP integration diagnostics. |

## CC-RX Compiler Notes

The Renesas Wi-SUN FAN integration is intended to be built with the Renesas C/C++ Compiler Package for RX MCUs, also known as CC-RX.

The integration keeps a small number of explicit casts for CC-RX compatibility.
The following casts are intentional:

- `ufield->wire_type = (ProtobufCWireType) scanned_member->wire_type;`

CC-RX reports `Enumerated type mixed with another type`

- `xfer_req->status != (uint32_t) FWHDR_STATUS_DOWNLOAD`

CC-RX reports `Integer conversion resulted in a change of sign`

These casts are the expected type conversion for the Renesas CC-RX compiler and keep the Renesas build warning-clean.

Reference: [Renesas C/C++ Compiler Package for RX Family [CC-RX]](https://www.renesas.com/en/software-tool/c-cplusplus-compiler-package-rx-family-cc-rx)

## Relevant Renesas resources

- [Renesas Sub-GHz/Wi-SUN FAN Transceivers](https://www.renesas.com/en/products/wireless-connectivity/sub-ghz-Wi-SUN-transceivers)

- [Renesas Sub-GHz/Wi-SUN FAN Protocol Stack](https://www.renesas.com/en/software-tool/sub-ghzWi-SUN-protocol-stack)
Binary file added Vendors/Renesas/resources/renesas-logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions include/csmp_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
#include <stdint.h>
#include <stdbool.h>
#include "osal.h"
#if defined(OSAL_RENESAS_WISUN)
#include "csmp.h"
#endif

/** maximum CSMP cert length */
#define MAX_SIGNATURE_CERT_LENGTH 512
Expand Down Expand Up @@ -100,6 +103,7 @@ typedef struct _dev_config {
csmp_cfg_t csmp_sig_settings;/**< the csmp signature settings data*/
} dev_config_t;

#if !defined(OSAL_RENESAS_WISUN)
Comment thread
manojnacsl marked this conversation as resolved.
/**
* @brief tlvid
*
Expand All @@ -108,6 +112,7 @@ typedef struct _tlvid {
uint32_t vendor; /**< vendor identification */
uint32_t type; /**< type identification */
} tlvid_t;
#endif

/**
* @brief GET function definition
Expand Down
4 changes: 2 additions & 2 deletions include/iana_pen.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ enum {
BC_HYDRO = 39480,
LANDIS_GYR = 42830,
TELLABS = 1397,
EXEGIN = 39682
//RENESAS
EXEGIN = 39682,
RENESAS = 63257
//ROHM
};

Expand Down
2 changes: 1 addition & 1 deletion osal/efr32_wisun/osal_platform_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ typedef int osal_sd_set_t;
#define GECKO_BTL_UPLOAD_SLOT_ID 0
#define GECKO_BTL_BACKUP_SLOT_ID 1

#endif
#endif
2 changes: 1 addition & 1 deletion osal/freertos/osal_platform_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ typedef fd_set osal_sd_set_t;
#define OSAL_AF_INET6 AF_INET6
#define OSAL_SOCK_DGRAM SOCK_DGRAM

#endif
#endif
2 changes: 1 addition & 1 deletion osal/linux/osal_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,4 +683,4 @@ int osal_copy_firmware(uint8_t source_slotid, uint8_t dest_slotid, Csmp_Slothdr

DPRINTF("osal_copy_firmware: Copied Slothdr Successfully\n");
return OSAL_SUCCESS;
}
}
2 changes: 1 addition & 1 deletion osal/linux/osal_platform_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ typedef fd_set osal_sd_set_t;



#endif
#endif
2 changes: 1 addition & 1 deletion osal/osal.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

// IMAGE SLOT INFO
Comment thread
manojnacsl marked this conversation as resolved.
#define CSMP_FWMGMT_ACTIVE_SLOTS 3 // 0-RUN, 1-UPLOAD, 2-BACKUP
#if defined(OSAL_EFR32_WISUN)
#if defined(OSAL_EFR32_WISUN) || defined(OSAL_RENESAS_WISUN)
#define CSMP_FWMGMT_SLOTIMG_SIZE (512*1024) // 512 Kb
#else
#define CSMP_FWMGMT_SLOTIMG_SIZE (30*1024) // 30 Kb
Expand Down
128 changes: 128 additions & 0 deletions osal/renesas_wisun/osal_platform_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/*
* Copyright 2026 Renesas Electronics Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef __OSAL_PLATFORM_TYPES_H
#define __OSAL_PLATFORM_TYPES_H

#include <assert.h>
#include <stdlib.h>
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#include "r_byte_swap.h"
#include "r_header_utils.h"
#if defined(__i386) || defined(__x86_64)

/* The Wi-SUN FAN simulator requires Unix sockets for basic functionality -> avoid redefinition */
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#else

/* Supported address families. */
#define AF_INET6 10 /* IP version 6 */

/* Type to represent a port. */
typedef uint16_t in_port_t;

typedef uint16_t sa_family_t;

typedef uint32_t socklen_t;

struct in6_addr
{
unsigned char s6_addr[16]; /* IPv6 address */
};

/* Structure describing a generic socket address. */
struct sockaddr
{
sa_family_t sa_family; /* Common data: address family and length. */
char sa_data[14]; /* Address data. */
};

struct sockaddr_in6
{
sa_family_t sin6_family; /* AF_INET6 */
in_port_t sin6_port; /* port number */
uint32_t sin6_flowinfo; /* IPv6 flow information */
struct in6_addr sin6_addr; /* IPv6 address */
uint32_t sin6_scope_id; /* Scope ID (new in 2.4) */
};

/* Structure for scatter/gather I/O. */
struct iovec
{
void* iov_base; /* Pointer to data. */
size_t iov_len; /* Length of data. */
};

/* Structure describing messages sent by
`sendmsg' and received by `recvmsg'. */
struct msghdr
{
void* msg_name; /* Address to send to/receive from. */
socklen_t msg_namelen; /* Length of address data. */

struct iovec* msg_iov; /* Vector of data to send/receive into. */
size_t msg_iovlen; /* Number of elements in the vector. */

void* msg_control; /* Ancillary data (eg BSD filedesc passing). */
size_t msg_controllen; /* Ancillary data buffer length.
!! The type should be socklen_t but the
definition of the kernel is incompatible
with this. */

int msg_flags; /* Flags on received message. */
};

#endif

typedef void (*osal_sighandler_t)(int);

typedef struct sockaddr_in6 osal_sockaddr_t;
typedef SemaphoreHandle_t osal_sem_t;
typedef int osal_sigset_t;
typedef socklen_t osal_socklen_t;
typedef TaskHandle_t osal_task_t;
typedef TaskFunction_t osal_task_fnc_t;
typedef int32_t osal_ssize_t;
typedef uint64_t osal_time_t;
typedef BaseType_t osal_basetype_t;
typedef int osal_socket_handle_t;
typedef int osal_sd_set_t;

#define OSAL_AF_INET6 AF_INET6
#define OSAL_SOCK_DGRAM 0

#define OSAL_ATTR_PACKED R_HEADER_UTILS_ATTR_PACKED

#define CSMP_MAX_SOCKETS 2

#if !defined(__i386) && !defined(__x86_64)
struct timeval
{
uint32_t tv_sec; /* Seconds. */
uint32_t tv_usec; /* Microseconds. */
};
#endif

struct timezone {
int tz_minuteswest; /* minutes west of Greenwich */
int tz_dsttime; /* type of DST correction */
};

#endif
67 changes: 67 additions & 0 deletions osal/renesas_wisun/osal_renesas.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright 2026 Renesas Electronics Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @file osal_renesas.h
* @brief Configuration and API of the CSMP module running within the Renesas Wi-SUN FAN sample application.
*/

#ifndef OSAL_RENESAS_H
#define OSAL_RENESAS_H

#include <stdint.h>
#include "r_nwk_api.h"

/** the major version of the CSMP module */
#define R_CSMP_MAJOR_VERSION "0"

/** the major version of the CSMP module */
#define R_CSMP_MINOR_VERSION "1"

/** the build version of the CSMP module */
#define R_CSMP_BUILD_VERSION "0"

/** string to identify this version of the CSMP module (in format "major.minor.build") */
#define R_CSMP_VERSION_STRING R_CSMP_MAJOR_VERSION "." R_CSMP_MINOR_VERSION "." R_CSMP_BUILD_VERSION

/** string to identify the running firmware */
#define R_CSMP_FILE_NAME "Wi-SUN-FAN-SampleApp"

/** string to identify this hardware platform as used by FND */
#define R_CSMP_HARDWARE_ID "renesastest"

/** max number of ip addresses */
#define R_TLV_IPADDRESS_MAX_NUM 3

/** max number of routes */
#define R_TLV_ROUTES_MAX_NUM 2

/**
* Start the CSMP module. Several periodic timers will be started.
* @param serverAddr The IPv6 address of the server (Cisco IoT Field Network Director).
* @param localEui64 The EUI-64 of this device.
* @param regImin The minimum registration interval of this device.
* @param regImax The maximum registration interval of this device.
* @return 0 if the CSMP module was successfully started.
*/
int R_CSMP_Start(const r_ipv6addr_t* serverAddr, const uint8_t* localEui64, uint32_t regImin, uint32_t regImax);

/**
* Stop the CSMP module and related timers.
* @return 0 if the CSMP module was successfully stopped.
*/
int R_CSMP_Stop();
#endif /* OSAL_RENESAS_H */
Loading