Skip to content

Commit

Permalink
Initial commit for the CMSIS NN sample code
Browse files Browse the repository at this point in the history
  • Loading branch information
ioannis-karachalios committed Jul 1, 2024
1 parent f458802 commit c84ceb8
Show file tree
Hide file tree
Showing 48 changed files with 6,712 additions and 0 deletions.
339 changes: 339 additions & 0 deletions features/cmsis_nn/.cproject

Large diffs are not rendered by default.

99 changes: 99 additions & 0 deletions features/cmsis_nn/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>cmsis_nn</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<linkedResources>
<link>
<name>sdk</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>startup</name>
<type>2</type>
<locationURI>SDKROOT/sdk/bsp/startup</locationURI>
</link>
<link>
<name>sdk/FreeRTOS</name>
<type>2</type>
<locationURI>SDKROOT/sdk/free_rtos</locationURI>
</link>
<link>
<name>sdk/adapters</name>
<type>2</type>
<locationURI>SDKROOT/sdk/middleware/adapters</locationURI>
</link>
<link>
<name>sdk/bsp_include</name>
<type>2</type>
<locationURI>SDKROOT/sdk/bsp/include</locationURI>
</link>
<link>
<name>sdk/config</name>
<type>2</type>
<locationURI>SDKROOT/sdk/bsp/config</locationURI>
</link>
<link>
<name>sdk/ldscripts</name>
<type>2</type>
<locationURI>SDKROOT/sdk/bsp/ldscripts/non_ble_projects</locationURI>
</link>
<link>
<name>sdk/memory</name>
<type>2</type>
<locationURI>SDKROOT/sdk/bsp/memory</locationURI>
</link>
<link>
<name>sdk/middleware_config</name>
<type>2</type>
<locationURI>SDKROOT/sdk/middleware/config</locationURI>
</link>
<link>
<name>sdk/osal</name>
<type>2</type>
<locationURI>SDKROOT/sdk/middleware/osal</locationURI>
</link>
<link>
<name>sdk/peripherals</name>
<type>2</type>
<locationURI>SDKROOT/sdk/bsp/peripherals</locationURI>
</link>
<link>
<name>sdk/sys_man</name>
<type>2</type>
<locationURI>SDKROOT/sdk/bsp/system/sys_man</locationURI>
</link>
<link>
<name>sdk/util</name>
<type>2</type>
<locationURI>SDKROOT/sdk/bsp/util</locationURI>
</link>
</linkedResources>
<variableList>
<variable>
<name>SDKROOT</name>
<value>$%7BWORKSPACE_LOC%7D</value>
</variable>
</variableList>
</projectDescription>
25 changes: 25 additions & 0 deletions features/cmsis_nn/.settings/language.settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<configuration id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.76586611.1007346875.660827118.235708102.1847866934.384067096" name="DA1459x-00-Debug_eFlash">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1224791091781103558" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
<configuration id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.76586611.1007346875.660827118.235708102.1847866934.384067096.802618131" name="DA1459x-00-Release_eFlash">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1202306965510295686" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
install.folder=/opt/SEGGER/JLink
37 changes: 37 additions & 0 deletions features/cmsis_nn/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# CMSIS NN Demonstration Example

This example runs the ARM CMSIS NN library on the DA1469x family of devices. Four of the tests from the CMSIS library have been extracted and used as a sanity check.

## HW and SW Configuration

- **Hardware Configuration**
- This example runs on the DA1459x family of devices.
- A [Pro Development Kit](https://www.renesas.com/us/en/products/wireless-connectivity/bluetooth-low-energy/da14592-016fdevkt-p-smartbond-da14592-bluetooth-low-energy-52-soc-development-kit-pro) (DevKit) is needed for this example.
- **Software Configuration**
- Download the latest [SDK](https://www.renesas.com/us/en/products/wireless-connectivity/bluetooth-low-energy/da14592-smartbond-multi-core-bluetooth-le-52-soc-embedded-flash?gad_source=1) version for the target family of devices.

- SEGGER J-Link tools are normally downloaded and installed as part of the [e2 Studio](https://www.renesas.com/us/en/software-tool/smartbond-development-tools) installation.

## How to run the example

### Initial Setup

- Download the source code from [GitHub](https://github.com/dialog-semiconductor/BLE_SDK10_DA1459x_examples).
- Import the project into your workspace (there should be no path dependencies). If you are not familiar with these processes it's advised that you first familiarize yourself with the [Getting Started](https://lpccs-docs.renesas.com/um-b-166-da1459x_getting_started/index.html) guide.
- Connect the target device to your host PC via USB1. The mentioned port is used to power the device and to support serial and JTAG interfaces. These two interfaces can be used both for flashing and debugging purposes.
- Compile the source code (either in Release or Debug mode) and flash it into the chip. Please note that the debug flavor should be used merely for debugging purposes since it should increase the generated binary file, significantly. In addition, the source code is built to work with the embedded flash Working with external flash memory devices is out of the scope of this demonstration example.
- Open a serial terminal (115200/8-N-1).
- Once the application image is flashed, press the RESET button on the daughter board to start executing the application.

- The terminal should display that the test vectors have run successfully (or not). The `#` should also be printed every second as the sample code is built on top of the `freertos_retarget` SDK sample code.

```
arm_fully_connected_s16 test success
arm_fully_connected_s16_big test success
int16xint8_arm_convolve_fast_s16 test success
requantize_s64_arm_convolve_fast_s16 test success
```

## Known Limitations

There should be no known limitations for this example.
66 changes: 66 additions & 0 deletions features/cmsis_nn/config/custom_config_eflash.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/**
****************************************************************************************
*
* @file custom_config_eflash.h
*
* @brief Board Support Package. User Configuration file for cached eFLASH mode.
*
* Copyright (C) 2020-2024 Renesas Electronics Corporation and/or its affiliates.
* All rights reserved. Confidential Information.
*
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
* revocable, non-sub-licensable right and license to use the Software, solely if used in
* or together with Renesas products. You may make copies of this Software, provided this
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
* reserves the right to change or discontinue the Software at any time without notice.
*
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
* SOFTWARE.
*
****************************************************************************************
*/

#ifndef CUSTOM_CONFIG_EFLASH_H_
#define CUSTOM_CONFIG_EFLASH_H_

#include "bsp_definitions.h"

#define CONFIG_RETARGET

#define dg_configEXEC_MODE MODE_IS_CACHED
#define dg_configCODE_LOCATION NON_VOLATILE_IS_EMBEDDED_FLASH

#define dg_configUSE_WDOG ( 1 )

#define dg_configUSE_SW_CURSOR ( 1 )

/*************************************************************************************************\
* FreeRTOS specific config
*/
#define OS_FREERTOS /* Define this to use FreeRTOS */
#define configTOTAL_HEAP_SIZE 14000 /* This is the FreeRTOS Total Heap Size */

/*************************************************************************************************\
* Peripheral specific config
*/
#define dg_configFLASH_ADAPTER ( 0 )
#define dg_configNVMS_ADAPTER ( 0 )
#define dg_configNVMS_VES ( 0 )

/* Include bsp default values */
#include "bsp_defaults.h"
/* Include middleware default values */
#include "middleware_defaults.h"

#endif /* CUSTOM_CONFIG_EFLASH_H_ */
Loading

0 comments on commit c84ceb8

Please sign in to comment.