adding nrf52840 port, able to blink led with pca10056
This commit is contained in:
@@ -75,7 +75,6 @@
|
|||||||
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="251" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/bsp/ea4357/nand.c" debugPath="../../../../hw/bsp/ea4357/nand.c" selected="0" top="243" codecName="Default"/>
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="251" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/bsp/ea4357/nand.c" debugPath="../../../../hw/bsp/ea4357/nand.c" selected="0" top="243" codecName="Default"/>
|
||||||
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="276" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/bsp/ea4357/oem_base_board/norflash.c" debugPath="../../../../hw/bsp/ea4357/oem_base_board/norflash.c" selected="0" top="269" codecName="Default"/>
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="276" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/bsp/ea4357/oem_base_board/norflash.c" debugPath="../../../../hw/bsp/ea4357/oem_base_board/norflash.c" selected="0" top="269" codecName="Default"/>
|
||||||
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="149" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/mcu/nxp/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_emc.c" debugPath="../../../../hw/mcu/nxp/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_emc.c" selected="0" top="130" codecName="Default"/>
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="149" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/mcu/nxp/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_emc.c" debugPath="../../../../hw/mcu/nxp/lpc43xx/CMSIS_LPC43xx_DriverLib/src/lpc43xx_emc.c" selected="0" top="130" codecName="Default"/>
|
||||||
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="663" useTextEdit="1" useBinaryEdit="0" left="0" path="system_LPC43xx.c" debugPath="system_LPC43xx.c" selected="0" top="660" codecName="Default"/>
|
|
||||||
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="39" useTextEdit="1" useBinaryEdit="0" left="0" path="LPC43xx_Vectors.s" debugPath="LPC43xx_Vectors.s" selected="1" top="22" codecName="Default"/>
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="39" useTextEdit="1" useBinaryEdit="0" left="0" path="LPC43xx_Vectors.s" debugPath="LPC43xx_Vectors.s" selected="1" top="22" codecName="Default"/>
|
||||||
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="0" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/bsp/board.c" debugPath="../../../../hw/bsp/board.c" selected="0" top="72" codecName="Default"/>
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="0" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/bsp/board.c" debugPath="../../../../hw/bsp/board.c" selected="0" top="72" codecName="Default"/>
|
||||||
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="87" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/bsp/printf_retarget.c" debugPath="../../../../hw/bsp/printf_retarget.c" selected="0" top="73" codecName="Default"/>
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="87" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/bsp/printf_retarget.c" debugPath="../../../../hw/bsp/printf_retarget.c" selected="0" top="73" codecName="Default"/>
|
||||||
|
|||||||
@@ -88,7 +88,7 @@
|
|||||||
</toolChain>
|
</toolChain>
|
||||||
</folderInfo>
|
</folderInfo>
|
||||||
<sourceEntries>
|
<sourceEntries>
|
||||||
<entry excluding="hw/bsp/ngx|hw/bsp/lpcxpresso1769|hw/bsp/lpcxpresso1347|hw/bsp/lpcxpresso11u68|hw/bsp/lpcxpresso|hw/bsp/keil|hw/bsp/hitex|hw/mcu/nxp/lpc175x_6x|hw/mcu/nxp/lpc13uxx|hw/mcu/nxp/lpc11uxx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
<entry excluding="hw/mcu/nordic|hw/bsp/pca10056|hw/bsp/ngx|hw/bsp/lpcxpresso1769|hw/bsp/lpcxpresso1347|hw/bsp/lpcxpresso11u68|hw/bsp/lpcxpresso|hw/bsp/keil|hw/bsp/hitex|hw/mcu/nxp/lpc175x_6x|hw/mcu/nxp/lpc13uxx|hw/mcu/nxp/lpc11uxx" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||||
</sourceEntries>
|
</sourceEntries>
|
||||||
</configuration>
|
</configuration>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<!DOCTYPE Board_Memory_Definition_File>
|
||||||
|
<root name="nRF52840_xxAA">
|
||||||
|
<MemorySegment name="FLASH" start="0x00000000" size="0x00100000" access="ReadOnly" />
|
||||||
|
<MemorySegment name="RAM" start="0x20000000" size="0x00040000" access="Read/Write" />
|
||||||
|
</root>
|
||||||
19
examples/device/nrf52840/segger/nRF_Target.js
Normal file
19
examples/device/nrf52840/segger/nRF_Target.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* SEGGER Microcontroller GmbH & Co. KG *
|
||||||
|
* Solutions for real time microcontroller applications *
|
||||||
|
*****************************************************************************
|
||||||
|
* *
|
||||||
|
* (c) 2017 SEGGER Microcontroller GmbH & Co. KG *
|
||||||
|
* *
|
||||||
|
* Internet: www.segger.com Support: support@segger.com *
|
||||||
|
* *
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
function Reset() {
|
||||||
|
TargetInterface.resetAndStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
function EnableTrace(traceInterfaceType) {
|
||||||
|
// TODO: Enable trace
|
||||||
|
}
|
||||||
|
|
||||||
93
examples/device/nrf52840/segger/nrf.h
Normal file
93
examples/device/nrf52840/segger/nrf.h
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Copyright (c) 2010 - 2017, Nordic Semiconductor ASA All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. 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.
|
||||||
|
|
||||||
|
3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from this
|
||||||
|
software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NRF_H
|
||||||
|
#define NRF_H
|
||||||
|
|
||||||
|
/* MDK version */
|
||||||
|
#define MDK_MAJOR_VERSION 8
|
||||||
|
#define MDK_MINOR_VERSION 15
|
||||||
|
#define MDK_MICRO_VERSION 0
|
||||||
|
|
||||||
|
/* Redefine "old" too-generic name NRF52 to NRF52832_XXAA to keep backwards compatibility. */
|
||||||
|
#if defined (NRF52)
|
||||||
|
#ifndef NRF52832_XXAA
|
||||||
|
#define NRF52832_XXAA
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define NRF52_SERIES for common use in nRF52 series devices. Only if not previously defined. */
|
||||||
|
#if defined (NRF52810_XXAA) || defined (NRF52832_XXAA) || defined (NRF52832_XXAB) || defined (NRF52840_XXAA)
|
||||||
|
#ifndef NRF52_SERIES
|
||||||
|
#define NRF52_SERIES
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
/* Do not include nrf specific files when building for PC host */
|
||||||
|
#elif defined(__unix)
|
||||||
|
/* Do not include nrf specific files when building for PC host */
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
/* Do not include nrf specific files when building for PC host */
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* Device selection for device includes. */
|
||||||
|
#if defined (NRF51)
|
||||||
|
#include "nrf51.h"
|
||||||
|
#include "nrf51_bitfields.h"
|
||||||
|
#include "nrf51_deprecated.h"
|
||||||
|
#elif defined (NRF52840_XXAA)
|
||||||
|
#include "nrf52840.h"
|
||||||
|
#include "nrf52840_bitfields.h"
|
||||||
|
#include "nrf51_to_nrf52840.h"
|
||||||
|
#include "nrf52_to_nrf52840.h"
|
||||||
|
#elif defined (NRF52832_XXAA) || defined (NRF52832_XXAB)
|
||||||
|
#include "nrf52.h"
|
||||||
|
#include "nrf52_bitfields.h"
|
||||||
|
#include "nrf51_to_nrf52.h"
|
||||||
|
#include "nrf52_name_change.h"
|
||||||
|
#elif defined (NRF52810_XXAA)
|
||||||
|
#include "nrf52810.h"
|
||||||
|
#include "nrf52810_bitfields.h"
|
||||||
|
#include "nrf51_to_nrf52810.h"
|
||||||
|
#include "nrf52_to_nrf52810.h"
|
||||||
|
#else
|
||||||
|
#error "Device must be defined. See nrf.h."
|
||||||
|
#endif /* NRF51, NRF52832_XXAA, NRF52832_XXAB, NRF52810_XXAA, NRF52840_XXAA */
|
||||||
|
|
||||||
|
#include "compiler_abstraction.h"
|
||||||
|
|
||||||
|
#endif /* _WIN32 || __unix || __APPLE__ */
|
||||||
|
|
||||||
|
#endif /* NRF_H */
|
||||||
|
|
||||||
108
examples/device/nrf52840/segger/nrf52840.emProject
Normal file
108
examples/device/nrf52840/segger/nrf52840.emProject
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
<!DOCTYPE CrossStudio_Project_File>
|
||||||
|
<solution Name="nrf52840" target="8" version="2">
|
||||||
|
<project Name="nrf52840">
|
||||||
|
<configuration
|
||||||
|
Name="Common"
|
||||||
|
Placement="Flash"
|
||||||
|
Target="nRF52840_xxAA"
|
||||||
|
arm_architecture="v7EM"
|
||||||
|
arm_core_type="Cortex-M4"
|
||||||
|
arm_endian="Little"
|
||||||
|
arm_fp_abi="Hard"
|
||||||
|
arm_fpu_type="FPv4-SP-D16"
|
||||||
|
arm_interwork="No"
|
||||||
|
arm_linker_heap_size="1024"
|
||||||
|
arm_linker_process_stack_size="0"
|
||||||
|
arm_linker_stack_size="1024"
|
||||||
|
arm_simulator_memory_simulation_parameter="ROM;0x00000000;0x00100000;RAM;0x20000000;0x00040000"
|
||||||
|
arm_target_debug_interface_type="ADIv5"
|
||||||
|
arm_target_device_name="nRF52840_xxAA"
|
||||||
|
arm_target_interface_type="SWD"
|
||||||
|
c_preprocessor_definitions="NRF52840_XXAA;__nRF_FAMILY;ARM_MATH_CM4;FLASH_PLACEMENT=1;BOARD_PCA10056"
|
||||||
|
c_user_include_directories="$(ProjectDir)/CMSIS_4/CMSIS/Include;$(ProjectDir)/nRF/CMSIS/Device/Include;$(RepoDir)/hw/cmsis/Include;$(RepoDir)/hw;$(McuDir)/hal;$(RepoDir)/tinyusb;$(McuDir)/sdk;$(McuDir)/sdk/drivers_nrf/hal;$(McuDir)/sdk/drivers_nrf/systick;$(McuDir)/sdk/drivers_nrf/uart;$(McuDir)/sdk/drivers_nrf/usbd;$(McuDir)/sdk/drivers_nrf/common;$(McuDir)/sdk/drivers_nrf/delay;$(McuDir)/sdk/drivers_nrf/power;$(McuDir)/sdk/drivers_nrf/clock;$(McuDir)/sdk/external/fprintf;$(McuDir)/sdk/libraries/util;$(McuDir)/sdk/libraries/strerror;$(McuDir)/sdk/libraries/atomic;$(McuDir)/sdk/libraries/balloc;$(McuDir)/sdk/libraries/experimental_log/src;$(McuDir)/sdk/libraries/experimental_log;$(McuDir)/sdk/libraries/experimental_section_vars;$(McuDir)/sdk/libraries/experimental_memobj;$(McuDir)/sdk/softdevice/s140/headers;$(McuDir)/sdk/softdevice/s140/headers/nrf52;$(McuDir)/sdk/softdevice/common;../src"
|
||||||
|
debug_register_definition_file="$(ProjectDir)/nrf52840_Registers.xml"
|
||||||
|
debug_target_connection="J-Link"
|
||||||
|
gcc_entry_point="Reset_Handler"
|
||||||
|
linker_memory_map_file="$(ProjectDir)/nRF52840_xxAA_MemoryMap.xml"
|
||||||
|
linker_section_placement_file="$(ProjectDir)/flash_placement.xml"
|
||||||
|
macros="DeviceHeaderFile=$(PackagesDir)/nRF/CMSIS/Device/Include/nrf.h;DeviceLibraryIdentifier=M4lf;DeviceSystemFile=$(PackagesDir)/nRF/CMSIS/Device/Source/system_nrf52840.c;DeviceVectorsFile=$(PackagesDir)/nRF/Source/ses_nrf52840_Vectors.s;DeviceFamily=nRF;Target=nRF52840_xxAA;Placement=Flash;RepoDir=../../../..;McuDir=../../../../hw/mcu/nordic/nrf52"
|
||||||
|
project_directory=""
|
||||||
|
project_type="Executable"
|
||||||
|
target_reset_script="Reset();"
|
||||||
|
target_script_file="$(ProjectDir)/nRF_Target.js"
|
||||||
|
target_trace_initialize_script="EnableTrace("$(TraceInterfaceType)")" />
|
||||||
|
<folder Name="CMSIS Files">
|
||||||
|
<file file_name="nrf.h" />
|
||||||
|
<file file_name="system_nrf52840.c">
|
||||||
|
<configuration
|
||||||
|
Name="Common"
|
||||||
|
default_code_section=".init"
|
||||||
|
default_const_section=".init_rodata" />
|
||||||
|
</file>
|
||||||
|
</folder>
|
||||||
|
<folder Name="RTT Files">
|
||||||
|
<file file_name="SEGGER_RTT.c" />
|
||||||
|
<file file_name="SEGGER_RTT.h" />
|
||||||
|
<file file_name="SEGGER_RTT_Conf.h" />
|
||||||
|
<file file_name="SEGGER_RTT_SES.c" />
|
||||||
|
</folder>
|
||||||
|
<folder Name="Script Files">
|
||||||
|
<file file_name="nRF_Target.js">
|
||||||
|
<configuration Name="Common" file_type="Reset Script" />
|
||||||
|
</file>
|
||||||
|
</folder>
|
||||||
|
<folder Name="System Files">
|
||||||
|
<file file_name="thumb_crt0.s" />
|
||||||
|
<file file_name="ses_nRF_Startup.s" />
|
||||||
|
<file file_name="ses_nrf52840_Vectors.s">
|
||||||
|
<configuration Name="Common" file_type="Assembly" />
|
||||||
|
</file>
|
||||||
|
</folder>
|
||||||
|
<folder
|
||||||
|
Name="tinyusb"
|
||||||
|
exclude=""
|
||||||
|
filter="*.c;*.h"
|
||||||
|
path="../../../../tinyusb"
|
||||||
|
recurse="Yes" />
|
||||||
|
<folder Name="src">
|
||||||
|
<file file_name="../src/main.c" />
|
||||||
|
<file file_name="../src/tusb_config.h" />
|
||||||
|
<file file_name="../src/tusb_descriptors.c" />
|
||||||
|
<file file_name="../src/tusb_descriptors.h" />
|
||||||
|
</folder>
|
||||||
|
<folder Name="hw">
|
||||||
|
<folder Name="bsp">
|
||||||
|
<folder Name="pca10056">
|
||||||
|
<file file_name="../../../../hw/bsp/pca10056/board_pca10056.c" />
|
||||||
|
<file file_name="../../../../hw/bsp/pca10056/board_pca10056.h" />
|
||||||
|
</folder>
|
||||||
|
</folder>
|
||||||
|
<folder Name="mcu">
|
||||||
|
<folder Name="nordic">
|
||||||
|
<folder Name="nrf52">
|
||||||
|
<folder Name="hal">
|
||||||
|
<file file_name="../../../../hw/mcu/nordic/nrf52/hal/hal_nrf52.c" />
|
||||||
|
</folder>
|
||||||
|
<folder
|
||||||
|
Name="sdk"
|
||||||
|
exclude=""
|
||||||
|
filter="*.c;*.h"
|
||||||
|
path="../../../../hw/mcu/nordic/nrf52/sdk"
|
||||||
|
recurse="Yes" />
|
||||||
|
</folder>
|
||||||
|
</folder>
|
||||||
|
</folder>
|
||||||
|
</folder>
|
||||||
|
</project>
|
||||||
|
<configuration
|
||||||
|
Name="Debug"
|
||||||
|
c_preprocessor_definitions="DEBUG"
|
||||||
|
gcc_debugging_level="Level 3"
|
||||||
|
gcc_optimization_level="None" />
|
||||||
|
<configuration
|
||||||
|
Name="Release"
|
||||||
|
c_preprocessor_definitions="NDEBUG"
|
||||||
|
gcc_debugging_level="None"
|
||||||
|
gcc_omit_frame_pointer="Yes"
|
||||||
|
gcc_optimization_level="Level 1" />
|
||||||
|
</solution>
|
||||||
104
examples/device/nrf52840/segger/nrf52840.emSession
Normal file
104
examples/device/nrf52840/segger/nrf52840.emSession
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
<!DOCTYPE CrossStudio_Session_File>
|
||||||
|
<session>
|
||||||
|
<Bookmarks/>
|
||||||
|
<Breakpoints groups="Breakpoints" active_group="Breakpoints">
|
||||||
|
<Exceptions set="MemManage;UsageFault_Coprocessor;UsageFault_CheckingError;UsageFault_StateError;BusFault;ExceptionEntryReturnFault;HardFault"/>
|
||||||
|
</Breakpoints>
|
||||||
|
<ExecutionProfileWindow/>
|
||||||
|
<FrameBufferWindow>
|
||||||
|
<FrameBufferWindow bufferHeight="-1" addressSpace="" addressText="" bufferWidth="-1"/>
|
||||||
|
</FrameBufferWindow>
|
||||||
|
<Memory1>
|
||||||
|
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" addressOrder="0" columnsText="" refreshPeriod="0" name="device_virtual_com" radix="16" sizeText="" addressText=""/>
|
||||||
|
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" addressOrder="0" columnsText="" refreshPeriod="0" name="nrf52840" radix="16" sizeText="" addressText=""/>
|
||||||
|
</Memory1>
|
||||||
|
<Memory2>
|
||||||
|
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" addressOrder="0" columnsText="" refreshPeriod="0" name="device_virtual_com" radix="16" sizeText="" addressText=""/>
|
||||||
|
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" addressOrder="0" columnsText="" refreshPeriod="0" name="nrf52840" radix="16" sizeText="" addressText=""/>
|
||||||
|
</Memory2>
|
||||||
|
<Memory3>
|
||||||
|
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" addressOrder="0" columnsText="" refreshPeriod="0" name="device_virtual_com" radix="16" sizeText="" addressText=""/>
|
||||||
|
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" addressOrder="0" columnsText="" refreshPeriod="0" name="nrf52840" radix="16" sizeText="" addressText=""/>
|
||||||
|
</Memory3>
|
||||||
|
<Memory4>
|
||||||
|
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" addressOrder="0" columnsText="" refreshPeriod="0" name="device_virtual_com" radix="16" sizeText="" addressText=""/>
|
||||||
|
<MemoryWindow addressSpace="" dataSize="1" autoEvaluate="0" viewMode="0" addressOrder="0" columnsText="" refreshPeriod="0" name="nrf52840" radix="16" sizeText="" addressText=""/>
|
||||||
|
</Memory4>
|
||||||
|
<Project>
|
||||||
|
<ProjectSessionItem path="nrf52840"/>
|
||||||
|
<ProjectSessionItem path="nrf52840;nrf52840"/>
|
||||||
|
<ProjectSessionItem path="nrf52840;nrf52840;hw"/>
|
||||||
|
<ProjectSessionItem path="nrf52840;nrf52840;hw;bsp"/>
|
||||||
|
<ProjectSessionItem path="nrf52840;nrf52840;hw;bsp;pca10056"/>
|
||||||
|
<ProjectSessionItem path="nrf52840;nrf52840;hw;mcu"/>
|
||||||
|
<ProjectSessionItem path="nrf52840;nrf52840;hw;mcu;nordic"/>
|
||||||
|
<ProjectSessionItem path="nrf52840;nrf52840;hw;mcu;nordic;nrf52"/>
|
||||||
|
<ProjectSessionItem path="nrf52840;nrf52840;hw;mcu;nordic;nrf52;hal"/>
|
||||||
|
<ProjectSessionItem path="nrf52840;nrf52840;hw;mcu;nordic;nrf52;sdk"/>
|
||||||
|
<ProjectSessionItem path="nrf52840;nrf52840;hw;mcu;nordic;nrf52;sdk;libraries"/>
|
||||||
|
<ProjectSessionItem path="nrf52840;nrf52840;hw;mcu;nordic;nrf52;sdk;libraries;experimental_log"/>
|
||||||
|
<ProjectSessionItem path="nrf52840;nrf52840;hw;mcu;nordic;nrf52;sdk;libraries;experimental_log;src"/>
|
||||||
|
<ProjectSessionItem path="nrf52840;nrf52840;hw;mcu;nordic;nrf52;sdk;libraries;experimental_memobj"/>
|
||||||
|
<ProjectSessionItem path="nrf52840;nrf52840;hw;mcu;nordic;nrf52;sdk;softdevice"/>
|
||||||
|
<ProjectSessionItem path="nrf52840;nrf52840;hw;mcu;nordic;nrf52;sdk;softdevice;common"/>
|
||||||
|
<ProjectSessionItem path="nrf52840;nrf52840;src"/>
|
||||||
|
<ProjectSessionItem path="nrf52840;nrf52840;tinyusb"/>
|
||||||
|
<ProjectSessionItem path="nrf52840;nrf52840;tinyusb;common"/>
|
||||||
|
</Project>
|
||||||
|
<Register1>
|
||||||
|
<RegisterWindow visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/msp;CPU/psp;CPU/cfbp" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="device_virtual_com" decimalNodes="" octalNodes="" unsignedNodes=""/>
|
||||||
|
<RegisterWindow visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/msp;CPU/psp;CPU/cfbp" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="nrf52840" decimalNodes="" octalNodes="" unsignedNodes=""/>
|
||||||
|
</Register1>
|
||||||
|
<Register2>
|
||||||
|
<RegisterWindow visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/msp;CPU/psp;CPU/cfbp" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="device_virtual_com" decimalNodes="" octalNodes="" unsignedNodes=""/>
|
||||||
|
<RegisterWindow visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/msp;CPU/psp;CPU/cfbp" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="nrf52840" decimalNodes="" octalNodes="" unsignedNodes=""/>
|
||||||
|
</Register2>
|
||||||
|
<Register3>
|
||||||
|
<RegisterWindow visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/msp;CPU/psp;CPU/cfbp" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="device_virtual_com" decimalNodes="" octalNodes="" unsignedNodes=""/>
|
||||||
|
<RegisterWindow visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/msp;CPU/psp;CPU/cfbp" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="nrf52840" decimalNodes="" octalNodes="" unsignedNodes=""/>
|
||||||
|
</Register3>
|
||||||
|
<Register4>
|
||||||
|
<RegisterWindow visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/msp;CPU/psp;CPU/cfbp" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="device_virtual_com" decimalNodes="" octalNodes="" unsignedNodes=""/>
|
||||||
|
<RegisterWindow visibleNodes="CPU - Current Context/r0;CPU - Current Context/r1;CPU - Current Context/r2;CPU - Current Context/r3;CPU - Current Context/r4;CPU - Current Context/r5;CPU - Current Context/r6;CPU - Current Context/r7;CPU - Current Context/r8;CPU - Current Context/r9;CPU - Current Context/r10;CPU - Current Context/r11;CPU - Current Context/r12;CPU - Current Context/sp(r13);CPU - Current Context/lr(r14);CPU - Current Context/pc(r15);CPU - Current Context/apsr;CPU/r0;CPU/r1;CPU/r2;CPU/r3;CPU/r4;CPU/r5;CPU/r6;CPU/r7;CPU/r8;CPU/r9;CPU/r10;CPU/r11;CPU/r12;CPU/sp(r13);CPU/lr(r14);CPU/pc(r15);CPU/xpsr;CPU/msp;CPU/psp;CPU/cfbp" binaryNodes="" asciiNodes="" openNodes="CPU - Current Context" name="nrf52840" decimalNodes="" octalNodes="" unsignedNodes=""/>
|
||||||
|
</Register4>
|
||||||
|
<TraceWindow>
|
||||||
|
<Trace enabled="Yes"/>
|
||||||
|
</TraceWindow>
|
||||||
|
<Watch1>
|
||||||
|
<Watches active="1" update="Never"/>
|
||||||
|
</Watch1>
|
||||||
|
<Watch2>
|
||||||
|
<Watches active="0" update="Never"/>
|
||||||
|
</Watch2>
|
||||||
|
<Watch3>
|
||||||
|
<Watches active="0" update="Never"/>
|
||||||
|
</Watch3>
|
||||||
|
<Watch4>
|
||||||
|
<Watches active="0" update="Never"/>
|
||||||
|
</Watch4>
|
||||||
|
<Files>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="48" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../tinyusb/common/common.h" debugPath="../../../../tinyusb/common/common.h" selected="0" top="27" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="35" y="65" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../tinyusb/tusb_option.h" debugPath="../../../../tinyusb/tusb_option.h" selected="0" top="53" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="12" y="86" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../tinyusb/tusb_hal.h" debugPath="../../../../tinyusb/tusb_hal.h" selected="0" top="59" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="69" useTextEdit="1" useBinaryEdit="0" left="0" path="nrf.h" debugPath="nrf.h" selected="0" top="60" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="116" useTextEdit="1" useBinaryEdit="0" left="0" path="nRF/CMSIS/Device/Include/nrf52840.h" debugPath="nRF/CMSIS/Device/Include/nrf52840.h" selected="0" top="90" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="35" y="96" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/bsp/board.h" debugPath="../../../../hw/bsp/board.h" selected="0" top="85" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="30" y="122" useTextEdit="1" useBinaryEdit="0" left="0" path="../src/main.c" debugPath="../src/main.c" selected="0" top="96" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="18" y="60" useTextEdit="1" useBinaryEdit="0" left="0" path="../src/tusb_config.h" debugPath="../src/tusb_config.h" selected="0" top="54" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="25" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../tinyusb/tusb.c" debugPath="../../../../tinyusb/tusb.c" selected="0" top="16" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="1" y="69" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/mcu/nordic/nrf52/hal/hal_nrf52.c" debugPath="../../../../hw/mcu/nordic/nrf52/hal/hal_nrf52.c" selected="0" top="41" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="24" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/mcu/nordic/nrf52/sdk/drivers_nrf/hal/nrf_saadc.c" debugPath="../../../../hw/mcu/nordic/nrf52/sdk/drivers_nrf/hal/nrf_saadc.c" selected="0" top="12" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="30" y="55" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/mcu/nordic/nrf52/sdk/drivers_nrf/uart/nrf_drv_uart.c" debugPath="../../../../hw/mcu/nordic/nrf52/sdk/drivers_nrf/uart/nrf_drv_uart.c" selected="0" top="32" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="39" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/mcu/nordic/nrf52/sdk/drivers_nrf/systick/nrf_drv_systick.c" debugPath="../../../../hw/mcu/nordic/nrf52/sdk/drivers_nrf/systick/nrf_drv_systick.c" selected="0" top="8" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="65" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/mcu/nordic/nrf52/sdk/libraries/util/sdk_errors.h" debugPath="../../../../hw/mcu/nordic/nrf52/sdk/libraries/util/sdk_errors.h" selected="0" top="44" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="41" y="65" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/mcu/nordic/nrf52/sdk/libraries/experimental_log/nrf_log.h" debugPath="../../../../hw/mcu/nordic/nrf52/sdk/libraries/experimental_log/nrf_log.h" selected="0" top="47" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="9" y="781" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/mcu/nordic/nrf52/sdk/drivers_nrf/usbd/nrf_drv_usbd.c" debugPath="../../../../hw/mcu/nordic/nrf52/sdk/drivers_nrf/usbd/nrf_drv_usbd.c" selected="0" top="767" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="44" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/bsp/pca10056/board_pca10056.c" debugPath="../../../../hw/bsp/pca10056/board_pca10056.c" selected="0" top="27" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="54" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/mcu/nordic/nrf52/sdk/drivers_nrf/common/nrf_drv_common.c" debugPath="../../../../hw/mcu/nordic/nrf52/sdk/drivers_nrf/common/nrf_drv_common.c" selected="0" top="37" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="28" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/mcu/nordic/nrf52/sdk/sdk_config.h" debugPath="../../../../hw/mcu/nordic/nrf52/sdk/sdk_config.h" selected="0" top="0" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="33" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/mcu/nordic/nrf52/sdk/libraries/experimental_log/nrf_log_backend_interface.h" debugPath="../../../../hw/mcu/nordic/nrf52/sdk/libraries/experimental_log/nrf_log_backend_interface.h" selected="0" top="22" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="50" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/mcu/nordic/nrf52/sdk/libraries/experimental_memobj/nrf_memobj.h" debugPath="../../../../hw/mcu/nordic/nrf52/sdk/libraries/experimental_memobj/nrf_memobj.h" selected="0" top="25" codecName="Default"/>
|
||||||
|
<SessionOpenFile windowGroup="DockEditLeft" x="0" y="57" useTextEdit="1" useBinaryEdit="0" left="0" path="../../../../hw/mcu/nordic/nrf52/sdk/libraries/experimental_log/src/nrf_log_backend_serial.h" debugPath="../../../../hw/mcu/nordic/nrf52/sdk/libraries/experimental_log/src/nrf_log_backend_serial.h" selected="1" top="32" codecName="Default"/>
|
||||||
|
</Files>
|
||||||
|
<ARMCrossStudioWindow activeProject="nrf52840" fileDialogDefaultFilter="*.c" autoConnectTarget="J-Link" buildConfiguration="Debug" debugSearchFileMap="" fileDialogInitialDirectory="/home/hathach/Dropbox/tinyusb/workspace/tinyusb/hw/mcu/nordic/nrf52/hal" debugSearchPath="" autoConnectCapabilities="3711"/>
|
||||||
|
</session>
|
||||||
39
examples/device/nrf52840/segger/nrf52840_Debug.jlink
Normal file
39
examples/device/nrf52840/segger/nrf52840_Debug.jlink
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
[BREAKPOINTS]
|
||||||
|
ForceImpTypeAny = 0
|
||||||
|
ShowInfoWin = 1
|
||||||
|
EnableFlashBP = 2
|
||||||
|
BPDuringExecution = 0
|
||||||
|
[CFI]
|
||||||
|
CFISize = 0x00
|
||||||
|
CFIAddr = 0x00
|
||||||
|
[CPU]
|
||||||
|
MonModeVTableAddr = 0xFFFFFFFF
|
||||||
|
MonModeDebug = 0
|
||||||
|
MaxNumAPs = 0
|
||||||
|
LowPowerHandlingMode = 0
|
||||||
|
OverrideMemMap = 0
|
||||||
|
AllowSimulation = 1
|
||||||
|
ScriptFile=""
|
||||||
|
[FLASH]
|
||||||
|
CacheExcludeSize = 0x00
|
||||||
|
CacheExcludeAddr = 0x00
|
||||||
|
MinNumBytesFlashDL = 0
|
||||||
|
SkipProgOnCRCMatch = 1
|
||||||
|
VerifyDownload = 1
|
||||||
|
AllowCaching = 1
|
||||||
|
EnableFlashDL = 2
|
||||||
|
Override = 0
|
||||||
|
Device="ARM7"
|
||||||
|
[GENERAL]
|
||||||
|
WorkRAMSize = 0x00
|
||||||
|
WorkRAMAddr = 0x00
|
||||||
|
RAMUsageLimit = 0x00
|
||||||
|
[SWO]
|
||||||
|
SWOLogFile=""
|
||||||
|
[MEM]
|
||||||
|
RdOverrideOrMask = 0x00
|
||||||
|
RdOverrideAndMask = 0xFFFFFFFF
|
||||||
|
RdOverrideAddr = 0xFFFFFFFF
|
||||||
|
WrOverrideOrMask = 0x00
|
||||||
|
WrOverrideAndMask = 0xFFFFFFFF
|
||||||
|
WrOverrideAddr = 0xFFFFFFFF
|
||||||
22310
examples/device/nrf52840/segger/nrf52840_Registers.xml
Normal file
22310
examples/device/nrf52840/segger/nrf52840_Registers.xml
Normal file
File diff suppressed because it is too large
Load Diff
148
examples/device/nrf52840/segger/ses_nRF_Startup.s
Normal file
148
examples/device/nrf52840/segger/ses_nRF_Startup.s
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* SEGGER Microcontroller GmbH & Co. KG *
|
||||||
|
* Solutions for real time microcontroller applications *
|
||||||
|
*****************************************************************************
|
||||||
|
* *
|
||||||
|
* (c) 2017 SEGGER Microcontroller GmbH & Co. KG *
|
||||||
|
* *
|
||||||
|
* Internet: www.segger.com Support: support@segger.com *
|
||||||
|
* *
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Preprocessor Definitions *
|
||||||
|
* ------------------------ *
|
||||||
|
* NO_FPU_ENABLE *
|
||||||
|
* *
|
||||||
|
* If defined, FPU will not be enabled. *
|
||||||
|
* *
|
||||||
|
* NO_STACK_INIT *
|
||||||
|
* *
|
||||||
|
* If defined, the stack pointer will not be initialised. *
|
||||||
|
* *
|
||||||
|
* NO_SYSTEM_INIT *
|
||||||
|
* *
|
||||||
|
* If defined, the SystemInit() function will not be called. By default *
|
||||||
|
* SystemInit() is called after reset to enable the clocks and memories to *
|
||||||
|
* be initialised prior to any C startup initialisation. *
|
||||||
|
* *
|
||||||
|
* NO_VTOR_CONFIG *
|
||||||
|
* *
|
||||||
|
* If defined, the vector table offset register will not be configured. *
|
||||||
|
* *
|
||||||
|
* MEMORY_INIT *
|
||||||
|
* *
|
||||||
|
* If defined, the MemoryInit() function will be called. By default *
|
||||||
|
* MemoryInit() is called after SystemInit() to enable an external memory *
|
||||||
|
* controller. *
|
||||||
|
* *
|
||||||
|
* STACK_INIT_VAL *
|
||||||
|
* *
|
||||||
|
* If defined, specifies the initial stack pointer value. If undefined, *
|
||||||
|
* the stack pointer will be initialised to point to the end of the *
|
||||||
|
* RAM segment. *
|
||||||
|
* *
|
||||||
|
* VECTORS_IN_RAM *
|
||||||
|
* *
|
||||||
|
* If defined, the exception vectors will be copied from Flash to RAM. *
|
||||||
|
* *
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
.syntax unified
|
||||||
|
|
||||||
|
.global Reset_Handler
|
||||||
|
#ifdef INITIALIZE_USER_SECTIONS
|
||||||
|
.global InitializeUserMemorySections
|
||||||
|
#endif
|
||||||
|
.extern _vectors
|
||||||
|
|
||||||
|
.section .init, "ax"
|
||||||
|
.thumb_func
|
||||||
|
|
||||||
|
.equ VTOR_REG, 0xE000ED08
|
||||||
|
.equ FPU_CPACR_REG, 0xE000ED88
|
||||||
|
|
||||||
|
#ifndef STACK_INIT_VAL
|
||||||
|
#define STACK_INIT_VAL __RAM_segment_end__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Reset_Handler:
|
||||||
|
#ifndef NO_STACK_INIT
|
||||||
|
/* Initialise main stack */
|
||||||
|
ldr r0, =STACK_INIT_VAL
|
||||||
|
ldr r1, =0x7
|
||||||
|
bics r0, r1
|
||||||
|
mov sp, r0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef NO_SYSTEM_INIT
|
||||||
|
/* Initialise system */
|
||||||
|
ldr r0, =SystemInit
|
||||||
|
blx r0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MEMORY_INIT
|
||||||
|
ldr r0, =MemoryInit
|
||||||
|
blx r0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VECTORS_IN_RAM
|
||||||
|
/* Copy exception vectors into RAM */
|
||||||
|
ldr r0, =__vectors_start__
|
||||||
|
ldr r1, =__vectors_end__
|
||||||
|
ldr r2, =__vectors_ram_start__
|
||||||
|
1:
|
||||||
|
cmp r0, r1
|
||||||
|
beq 2f
|
||||||
|
ldr r3, [r0]
|
||||||
|
str r3, [r2]
|
||||||
|
adds r0, r0, #4
|
||||||
|
adds r2, r2, #4
|
||||||
|
b 1b
|
||||||
|
2:
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef NO_VTOR_CONFIG
|
||||||
|
/* Configure vector table offset register */
|
||||||
|
ldr r0, =VTOR_REG
|
||||||
|
#ifdef VECTORS_IN_RAM
|
||||||
|
ldr r1, =_vectors_ram
|
||||||
|
#else
|
||||||
|
ldr r1, =_vectors
|
||||||
|
#endif
|
||||||
|
str r1, [r0]
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (defined(__ARM_ARCH_FPV4_SP_D16__) || defined(__ARM_ARCH_FPV5_D16__)) && !defined(NO_FPU_ENABLE)
|
||||||
|
/* Enable FPU */
|
||||||
|
ldr r0, =FPU_CPACR_REG
|
||||||
|
ldr r1, [r0]
|
||||||
|
orr r1, r1, #(0xF << 20)
|
||||||
|
str r1, [r0]
|
||||||
|
dsb
|
||||||
|
isb
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Jump to program start */
|
||||||
|
b _start
|
||||||
|
|
||||||
|
#ifdef INITIALIZE_USER_SECTIONS
|
||||||
|
.thumb_func
|
||||||
|
InitializeUserMemorySections:
|
||||||
|
ldr r0, =__start_nrf_sections
|
||||||
|
ldr r1, =__start_nrf_sections_run
|
||||||
|
ldr r2, =__end_nrf_sections_run
|
||||||
|
cmp r0, r1
|
||||||
|
beq 2f
|
||||||
|
subs r2, r2, r1
|
||||||
|
beq 2f
|
||||||
|
1:
|
||||||
|
ldrb r3, [r0]
|
||||||
|
adds r0, r0, #1
|
||||||
|
strb r3, [r1]
|
||||||
|
adds r1, r1, #1
|
||||||
|
subs r2, r2, #1
|
||||||
|
bne 1b
|
||||||
|
2:
|
||||||
|
bx lr
|
||||||
|
#endif
|
||||||
513
examples/device/nrf52840/segger/ses_nrf52840_Vectors.s
Normal file
513
examples/device/nrf52840/segger/ses_nrf52840_Vectors.s
Normal file
@@ -0,0 +1,513 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* SEGGER Microcontroller GmbH & Co. KG *
|
||||||
|
* Solutions for real time microcontroller applications *
|
||||||
|
*****************************************************************************
|
||||||
|
* *
|
||||||
|
* (c) 2017 SEGGER Microcontroller GmbH & Co. KG *
|
||||||
|
* *
|
||||||
|
* Internet: www.segger.com Support: support@segger.com *
|
||||||
|
* *
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Preprocessor Definitions *
|
||||||
|
* ------------------------ *
|
||||||
|
* VECTORS_IN_RAM *
|
||||||
|
* *
|
||||||
|
* If defined, an area of RAM will large enough to store the vector table *
|
||||||
|
* will be reserved. *
|
||||||
|
* *
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
.syntax unified
|
||||||
|
.code 16
|
||||||
|
|
||||||
|
.section .init, "ax"
|
||||||
|
.align 0
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Default Exception Handlers *
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak NMI_Handler
|
||||||
|
NMI_Handler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak HardFault_Handler
|
||||||
|
HardFault_Handler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak MemoryManagement_Handler
|
||||||
|
MemoryManagement_Handler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak BusFault_Handler
|
||||||
|
BusFault_Handler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak UsageFault_Handler
|
||||||
|
UsageFault_Handler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak SVC_Handler
|
||||||
|
SVC_Handler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak DebugMon_Handler
|
||||||
|
DebugMon_Handler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak PendSV_Handler
|
||||||
|
PendSV_Handler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak SysTick_Handler
|
||||||
|
SysTick_Handler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
Dummy_Handler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
#if defined(__OPTIMIZATION_SMALL)
|
||||||
|
|
||||||
|
.weak POWER_CLOCK_IRQHandler
|
||||||
|
.thumb_set POWER_CLOCK_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak RADIO_IRQHandler
|
||||||
|
.thumb_set RADIO_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak UARTE0_UART0_IRQHandler
|
||||||
|
.thumb_set UARTE0_UART0_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler
|
||||||
|
.thumb_set SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler
|
||||||
|
.thumb_set SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak NFCT_IRQHandler
|
||||||
|
.thumb_set NFCT_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak GPIOTE_IRQHandler
|
||||||
|
.thumb_set GPIOTE_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak SAADC_IRQHandler
|
||||||
|
.thumb_set SAADC_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak TIMER0_IRQHandler
|
||||||
|
.thumb_set TIMER0_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak TIMER1_IRQHandler
|
||||||
|
.thumb_set TIMER1_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak TIMER2_IRQHandler
|
||||||
|
.thumb_set TIMER2_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak RTC0_IRQHandler
|
||||||
|
.thumb_set RTC0_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak TEMP_IRQHandler
|
||||||
|
.thumb_set TEMP_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak RNG_IRQHandler
|
||||||
|
.thumb_set RNG_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak ECB_IRQHandler
|
||||||
|
.thumb_set ECB_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak CCM_AAR_IRQHandler
|
||||||
|
.thumb_set CCM_AAR_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak WDT_IRQHandler
|
||||||
|
.thumb_set WDT_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak RTC1_IRQHandler
|
||||||
|
.thumb_set RTC1_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak QDEC_IRQHandler
|
||||||
|
.thumb_set QDEC_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak COMP_LPCOMP_IRQHandler
|
||||||
|
.thumb_set COMP_LPCOMP_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak SWI0_EGU0_IRQHandler
|
||||||
|
.thumb_set SWI0_EGU0_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak SWI1_EGU1_IRQHandler
|
||||||
|
.thumb_set SWI1_EGU1_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak SWI2_EGU2_IRQHandler
|
||||||
|
.thumb_set SWI2_EGU2_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak SWI3_EGU3_IRQHandler
|
||||||
|
.thumb_set SWI3_EGU3_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak SWI4_EGU4_IRQHandler
|
||||||
|
.thumb_set SWI4_EGU4_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak SWI5_EGU5_IRQHandler
|
||||||
|
.thumb_set SWI5_EGU5_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak TIMER3_IRQHandler
|
||||||
|
.thumb_set TIMER3_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak TIMER4_IRQHandler
|
||||||
|
.thumb_set TIMER4_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak PWM0_IRQHandler
|
||||||
|
.thumb_set PWM0_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak PDM_IRQHandler
|
||||||
|
.thumb_set PDM_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak MWU_IRQHandler
|
||||||
|
.thumb_set MWU_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak PWM1_IRQHandler
|
||||||
|
.thumb_set PWM1_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak PWM2_IRQHandler
|
||||||
|
.thumb_set PWM2_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak SPIM2_SPIS2_SPI2_IRQHandler
|
||||||
|
.thumb_set SPIM2_SPIS2_SPI2_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak RTC2_IRQHandler
|
||||||
|
.thumb_set RTC2_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak I2S_IRQHandler
|
||||||
|
.thumb_set I2S_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak FPU_IRQHandler
|
||||||
|
.thumb_set FPU_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak USBD_IRQHandler
|
||||||
|
.thumb_set USBD_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak UARTE1_IRQHandler
|
||||||
|
.thumb_set UARTE1_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak QSPI_IRQHandler
|
||||||
|
.thumb_set QSPI_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak CRYPTOCELL_IRQHandler
|
||||||
|
.thumb_set CRYPTOCELL_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak SPIM3_IRQHandler
|
||||||
|
.thumb_set SPIM3_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
.weak PWM3_IRQHandler
|
||||||
|
.thumb_set PWM3_IRQHandler,Dummy_Handler
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak POWER_CLOCK_IRQHandler
|
||||||
|
POWER_CLOCK_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak RADIO_IRQHandler
|
||||||
|
RADIO_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak UARTE0_UART0_IRQHandler
|
||||||
|
UARTE0_UART0_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler
|
||||||
|
SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler
|
||||||
|
SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak NFCT_IRQHandler
|
||||||
|
NFCT_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak GPIOTE_IRQHandler
|
||||||
|
GPIOTE_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak SAADC_IRQHandler
|
||||||
|
SAADC_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak TIMER0_IRQHandler
|
||||||
|
TIMER0_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak TIMER1_IRQHandler
|
||||||
|
TIMER1_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak TIMER2_IRQHandler
|
||||||
|
TIMER2_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak RTC0_IRQHandler
|
||||||
|
RTC0_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak TEMP_IRQHandler
|
||||||
|
TEMP_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak RNG_IRQHandler
|
||||||
|
RNG_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak ECB_IRQHandler
|
||||||
|
ECB_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak CCM_AAR_IRQHandler
|
||||||
|
CCM_AAR_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak WDT_IRQHandler
|
||||||
|
WDT_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak RTC1_IRQHandler
|
||||||
|
RTC1_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak QDEC_IRQHandler
|
||||||
|
QDEC_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak COMP_LPCOMP_IRQHandler
|
||||||
|
COMP_LPCOMP_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak SWI0_EGU0_IRQHandler
|
||||||
|
SWI0_EGU0_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak SWI1_EGU1_IRQHandler
|
||||||
|
SWI1_EGU1_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak SWI2_EGU2_IRQHandler
|
||||||
|
SWI2_EGU2_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak SWI3_EGU3_IRQHandler
|
||||||
|
SWI3_EGU3_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak SWI4_EGU4_IRQHandler
|
||||||
|
SWI4_EGU4_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak SWI5_EGU5_IRQHandler
|
||||||
|
SWI5_EGU5_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak TIMER3_IRQHandler
|
||||||
|
TIMER3_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak TIMER4_IRQHandler
|
||||||
|
TIMER4_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak PWM0_IRQHandler
|
||||||
|
PWM0_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak PDM_IRQHandler
|
||||||
|
PDM_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak MWU_IRQHandler
|
||||||
|
MWU_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak PWM1_IRQHandler
|
||||||
|
PWM1_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak PWM2_IRQHandler
|
||||||
|
PWM2_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak SPIM2_SPIS2_SPI2_IRQHandler
|
||||||
|
SPIM2_SPIS2_SPI2_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak RTC2_IRQHandler
|
||||||
|
RTC2_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak I2S_IRQHandler
|
||||||
|
I2S_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak FPU_IRQHandler
|
||||||
|
FPU_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak USBD_IRQHandler
|
||||||
|
USBD_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak UARTE1_IRQHandler
|
||||||
|
UARTE1_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak QSPI_IRQHandler
|
||||||
|
QSPI_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak CRYPTOCELL_IRQHandler
|
||||||
|
CRYPTOCELL_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak SPIM3_IRQHandler
|
||||||
|
SPIM3_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
.weak PWM3_IRQHandler
|
||||||
|
PWM3_IRQHandler:
|
||||||
|
b .
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Vector Table *
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
.section .vectors, "ax"
|
||||||
|
.align 0
|
||||||
|
.global _vectors
|
||||||
|
.extern __stack_end__
|
||||||
|
.extern Reset_Handler
|
||||||
|
|
||||||
|
_vectors:
|
||||||
|
.word __stack_end__
|
||||||
|
.word Reset_Handler
|
||||||
|
.word NMI_Handler
|
||||||
|
.word HardFault_Handler
|
||||||
|
.word MemoryManagement_Handler
|
||||||
|
.word BusFault_Handler
|
||||||
|
.word UsageFault_Handler
|
||||||
|
.word 0 /* Reserved */
|
||||||
|
.word 0 /* Reserved */
|
||||||
|
.word 0 /* Reserved */
|
||||||
|
.word 0 /* Reserved */
|
||||||
|
.word SVC_Handler
|
||||||
|
.word DebugMon_Handler
|
||||||
|
.word 0 /* Reserved */
|
||||||
|
.word PendSV_Handler
|
||||||
|
.word SysTick_Handler
|
||||||
|
.word POWER_CLOCK_IRQHandler
|
||||||
|
.word RADIO_IRQHandler
|
||||||
|
.word UARTE0_UART0_IRQHandler
|
||||||
|
.word SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler
|
||||||
|
.word SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler
|
||||||
|
.word NFCT_IRQHandler
|
||||||
|
.word GPIOTE_IRQHandler
|
||||||
|
.word SAADC_IRQHandler
|
||||||
|
.word TIMER0_IRQHandler
|
||||||
|
.word TIMER1_IRQHandler
|
||||||
|
.word TIMER2_IRQHandler
|
||||||
|
.word RTC0_IRQHandler
|
||||||
|
.word TEMP_IRQHandler
|
||||||
|
.word RNG_IRQHandler
|
||||||
|
.word ECB_IRQHandler
|
||||||
|
.word CCM_AAR_IRQHandler
|
||||||
|
.word WDT_IRQHandler
|
||||||
|
.word RTC1_IRQHandler
|
||||||
|
.word QDEC_IRQHandler
|
||||||
|
.word COMP_LPCOMP_IRQHandler
|
||||||
|
.word SWI0_EGU0_IRQHandler
|
||||||
|
.word SWI1_EGU1_IRQHandler
|
||||||
|
.word SWI2_EGU2_IRQHandler
|
||||||
|
.word SWI3_EGU3_IRQHandler
|
||||||
|
.word SWI4_EGU4_IRQHandler
|
||||||
|
.word SWI5_EGU5_IRQHandler
|
||||||
|
.word TIMER3_IRQHandler
|
||||||
|
.word TIMER4_IRQHandler
|
||||||
|
.word PWM0_IRQHandler
|
||||||
|
.word PDM_IRQHandler
|
||||||
|
.word Dummy_Handler /* Reserved */
|
||||||
|
.word Dummy_Handler /* Reserved */
|
||||||
|
.word MWU_IRQHandler
|
||||||
|
.word PWM1_IRQHandler
|
||||||
|
.word PWM2_IRQHandler
|
||||||
|
.word SPIM2_SPIS2_SPI2_IRQHandler
|
||||||
|
.word RTC2_IRQHandler
|
||||||
|
.word I2S_IRQHandler
|
||||||
|
.word FPU_IRQHandler
|
||||||
|
.word USBD_IRQHandler
|
||||||
|
.word UARTE1_IRQHandler
|
||||||
|
.word QSPI_IRQHandler
|
||||||
|
.word CRYPTOCELL_IRQHandler
|
||||||
|
.word SPIM3_IRQHandler
|
||||||
|
.word Dummy_Handler /* Reserved */
|
||||||
|
.word PWM3_IRQHandler
|
||||||
|
_vectors_end:
|
||||||
|
|
||||||
|
#ifdef VECTORS_IN_RAM
|
||||||
|
.section .vectors_ram, "ax"
|
||||||
|
.align 0
|
||||||
|
.global _vectors_ram
|
||||||
|
|
||||||
|
_vectors_ram:
|
||||||
|
.space _vectors_end - _vectors, 0
|
||||||
|
#endif
|
||||||
256
examples/device/nrf52840/segger/system_nrf52840.c
Normal file
256
examples/device/nrf52840/segger/system_nrf52840.c
Normal file
@@ -0,0 +1,256 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Copyright (c) 2009-2017 ARM Limited. All rights reserved.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
NOTICE: This file has been modified by Nordic Semiconductor ASA.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* NOTE: Template files (including this one) are application specific and therefore expected to
|
||||||
|
be copied into the application project folder prior to its use! */
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "nrf.h"
|
||||||
|
#include "system_nrf52840.h"
|
||||||
|
|
||||||
|
/*lint ++flb "Enter library region" */
|
||||||
|
|
||||||
|
#define __SYSTEM_CLOCK_64M (64000000UL)
|
||||||
|
|
||||||
|
static bool errata_36(void);
|
||||||
|
static bool errata_66(void);
|
||||||
|
static bool errata_98(void);
|
||||||
|
static bool errata_103(void);
|
||||||
|
static bool errata_115(void);
|
||||||
|
static bool errata_120(void);
|
||||||
|
static bool errata_136(void);
|
||||||
|
|
||||||
|
|
||||||
|
#if defined ( __CC_ARM )
|
||||||
|
uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK_64M;
|
||||||
|
#elif defined ( __ICCARM__ )
|
||||||
|
__root uint32_t SystemCoreClock = __SYSTEM_CLOCK_64M;
|
||||||
|
#elif defined ( __GNUC__ )
|
||||||
|
uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK_64M;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void SystemCoreClockUpdate(void)
|
||||||
|
{
|
||||||
|
SystemCoreClock = __SYSTEM_CLOCK_64M;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SystemInit(void)
|
||||||
|
{
|
||||||
|
/* Enable SWO trace functionality. If ENABLE_SWO is not defined, SWO pin will be used as GPIO (see Product
|
||||||
|
Specification to see which one). */
|
||||||
|
#if defined (ENABLE_SWO)
|
||||||
|
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
|
||||||
|
NRF_CLOCK->TRACECONFIG |= CLOCK_TRACECONFIG_TRACEMUX_Serial << CLOCK_TRACECONFIG_TRACEMUX_Pos;
|
||||||
|
NRF_P1->PIN_CNF[0] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Enable Trace functionality. If ENABLE_TRACE is not defined, TRACE pins will be used as GPIOs (see Product
|
||||||
|
Specification to see which ones). */
|
||||||
|
#if defined (ENABLE_TRACE)
|
||||||
|
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
|
||||||
|
NRF_CLOCK->TRACECONFIG |= CLOCK_TRACECONFIG_TRACEMUX_Parallel << CLOCK_TRACECONFIG_TRACEMUX_Pos;
|
||||||
|
NRF_P0->PIN_CNF[7] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
|
||||||
|
NRF_P1->PIN_CNF[0] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
|
||||||
|
NRF_P0->PIN_CNF[12] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
|
||||||
|
NRF_P0->PIN_CNF[11] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
|
||||||
|
NRF_P1->PIN_CNF[9] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Workaround for Errata 36 "CLOCK: Some registers are not reset when expected" found at the Errata document
|
||||||
|
for your device located at https://infocenter.nordicsemi.com/ */
|
||||||
|
if (errata_36()){
|
||||||
|
NRF_CLOCK->EVENTS_DONE = 0;
|
||||||
|
NRF_CLOCK->EVENTS_CTTO = 0;
|
||||||
|
NRF_CLOCK->CTIV = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Workaround for Errata 66 "TEMP: Linearity specification not met with default settings" found at the Errata document
|
||||||
|
for your device located at https://infocenter.nordicsemi.com/ */
|
||||||
|
if (errata_66()){
|
||||||
|
NRF_TEMP->A0 = NRF_FICR->TEMP.A0;
|
||||||
|
NRF_TEMP->A1 = NRF_FICR->TEMP.A1;
|
||||||
|
NRF_TEMP->A2 = NRF_FICR->TEMP.A2;
|
||||||
|
NRF_TEMP->A3 = NRF_FICR->TEMP.A3;
|
||||||
|
NRF_TEMP->A4 = NRF_FICR->TEMP.A4;
|
||||||
|
NRF_TEMP->A5 = NRF_FICR->TEMP.A5;
|
||||||
|
NRF_TEMP->B0 = NRF_FICR->TEMP.B0;
|
||||||
|
NRF_TEMP->B1 = NRF_FICR->TEMP.B1;
|
||||||
|
NRF_TEMP->B2 = NRF_FICR->TEMP.B2;
|
||||||
|
NRF_TEMP->B3 = NRF_FICR->TEMP.B3;
|
||||||
|
NRF_TEMP->B4 = NRF_FICR->TEMP.B4;
|
||||||
|
NRF_TEMP->B5 = NRF_FICR->TEMP.B5;
|
||||||
|
NRF_TEMP->T0 = NRF_FICR->TEMP.T0;
|
||||||
|
NRF_TEMP->T1 = NRF_FICR->TEMP.T1;
|
||||||
|
NRF_TEMP->T2 = NRF_FICR->TEMP.T2;
|
||||||
|
NRF_TEMP->T3 = NRF_FICR->TEMP.T3;
|
||||||
|
NRF_TEMP->T4 = NRF_FICR->TEMP.T4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Workaround for Errata 98 "NFCT: Not able to communicate with the peer" found at the Errata document
|
||||||
|
for your device located at https://infocenter.nordicsemi.com/ */
|
||||||
|
if (errata_98()){
|
||||||
|
*(volatile uint32_t *)0x4000568Cul = 0x00038148ul;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Workaround for Errata 103 "CCM: Wrong reset value of CCM MAXPACKETSIZE" found at the Errata document
|
||||||
|
for your device located at https://infocenter.nordicsemi.com/ */
|
||||||
|
if (errata_103()){
|
||||||
|
NRF_CCM->MAXPACKETSIZE = 0xFBul;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Workaround for Errata 115 "RAM: RAM content cannot be trusted upon waking up from System ON Idle or System OFF mode" found at the Errata document
|
||||||
|
for your device located at https://infocenter.nordicsemi.com/ */
|
||||||
|
if (errata_115()){
|
||||||
|
*(volatile uint32_t *)0x40000EE4 = (*(volatile uint32_t *)0x40000EE4 & 0xFFFFFFF0) | (*(uint32_t *)0x10000258 & 0x0000000F);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Workaround for Errata 120 "QSPI: Data read or written is corrupted" found at the Errata document
|
||||||
|
for your device located at https://infocenter.nordicsemi.com/ */
|
||||||
|
if (errata_120()){
|
||||||
|
*(volatile uint32_t *)0x40029640ul = 0x200ul;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Workaround for Errata 136 "System: Bits in RESETREAS are set when they should not be" found at the Errata document
|
||||||
|
for your device located at https://infocenter.nordicsemi.com/ */
|
||||||
|
if (errata_136()){
|
||||||
|
if (NRF_POWER->RESETREAS & POWER_RESETREAS_RESETPIN_Msk){
|
||||||
|
NRF_POWER->RESETREAS = ~POWER_RESETREAS_RESETPIN_Msk;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Enable the FPU if the compiler used floating point unit instructions. __FPU_USED is a MACRO defined by the
|
||||||
|
* compiler. Since the FPU consumes energy, remember to disable FPU use in the compiler if floating point unit
|
||||||
|
* operations are not used in your code. */
|
||||||
|
#if (__FPU_USED == 1)
|
||||||
|
SCB->CPACR |= (3UL << 20) | (3UL << 22);
|
||||||
|
__DSB();
|
||||||
|
__ISB();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Configure NFCT pins as GPIOs if NFCT is not to be used in your code. If CONFIG_NFCT_PINS_AS_GPIOS is not defined,
|
||||||
|
two GPIOs (see Product Specification to see which ones) will be reserved for NFC and will not be available as
|
||||||
|
normal GPIOs. */
|
||||||
|
#if defined (CONFIG_NFCT_PINS_AS_GPIOS)
|
||||||
|
if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk) == (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)){
|
||||||
|
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
|
||||||
|
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
|
||||||
|
NRF_UICR->NFCPINS &= ~UICR_NFCPINS_PROTECT_Msk;
|
||||||
|
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
|
||||||
|
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
|
||||||
|
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
|
||||||
|
NVIC_SystemReset();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Configure GPIO pads as pPin Reset pin if Pin Reset capabilities desired. If CONFIG_GPIO_AS_PINRESET is not
|
||||||
|
defined, pin reset will not be available. One GPIO (see Product Specification to see which one) will then be
|
||||||
|
reserved for PinReset and not available as normal GPIO. */
|
||||||
|
#if defined (CONFIG_GPIO_AS_PINRESET)
|
||||||
|
if (((NRF_UICR->PSELRESET[0] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos)) ||
|
||||||
|
((NRF_UICR->PSELRESET[1] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos))){
|
||||||
|
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
|
||||||
|
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
|
||||||
|
NRF_UICR->PSELRESET[0] = 18;
|
||||||
|
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
|
||||||
|
NRF_UICR->PSELRESET[1] = 18;
|
||||||
|
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
|
||||||
|
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
|
||||||
|
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
|
||||||
|
NVIC_SystemReset();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SystemCoreClockUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool errata_36(void)
|
||||||
|
{
|
||||||
|
if ((*(uint32_t *)0x10000130ul == 0x8ul) && (*(uint32_t *)0x10000134ul == 0x0ul)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool errata_66(void)
|
||||||
|
{
|
||||||
|
if ((*(uint32_t *)0x10000130ul == 0x8ul) && (*(uint32_t *)0x10000134ul == 0x0ul)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool errata_98(void)
|
||||||
|
{
|
||||||
|
if ((*(uint32_t *)0x10000130ul == 0x8ul) && (*(uint32_t *)0x10000134ul == 0x0ul)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool errata_103(void)
|
||||||
|
{
|
||||||
|
if ((*(uint32_t *)0x10000130ul == 0x8ul) && (*(uint32_t *)0x10000134ul == 0x0ul)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool errata_115(void)
|
||||||
|
{
|
||||||
|
if ((*(uint32_t *)0x10000130ul == 0x8ul) && (*(uint32_t *)0x10000134ul == 0x0ul)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool errata_120(void)
|
||||||
|
{
|
||||||
|
if ((*(uint32_t *)0x10000130ul == 0x8ul) && (*(uint32_t *)0x10000134ul == 0x0ul)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool errata_136(void)
|
||||||
|
{
|
||||||
|
if ((*(uint32_t *)0x10000130ul == 0x8ul) && (*(uint32_t *)0x10000134ul == 0x0ul)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*lint --flb "Leave library region" */
|
||||||
420
examples/device/nrf52840/segger/thumb_crt0.s
Normal file
420
examples/device/nrf52840/segger/thumb_crt0.s
Normal file
@@ -0,0 +1,420 @@
|
|||||||
|
// SEGGER Embedded Studio, runtime support.
|
||||||
|
//
|
||||||
|
// Copyright (c) 2014-2017 SEGGER Microcontroller GmbH & Co KG
|
||||||
|
// Copyright (c) 2001-2017 Rowley Associates Limited.
|
||||||
|
//
|
||||||
|
// This file may be distributed under the terms of the License Agreement
|
||||||
|
// provided with this software.
|
||||||
|
//
|
||||||
|
// THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||||
|
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Preprocessor Definitions
|
||||||
|
// ------------------------
|
||||||
|
// APP_ENTRY_POINT
|
||||||
|
//
|
||||||
|
// Defines the application entry point function, if undefined this setting
|
||||||
|
// defaults to "main".
|
||||||
|
//
|
||||||
|
// INITIALIZE_STACK
|
||||||
|
//
|
||||||
|
// If defined, the contents of the stack will be initialized to a the
|
||||||
|
// value 0xCC.
|
||||||
|
//
|
||||||
|
// INITIALIZE_SECONDARY_SECTIONS
|
||||||
|
//
|
||||||
|
// If defined, the .data2, .text2, .rodata2 and .bss2 sections will be initialized.
|
||||||
|
//
|
||||||
|
// INITIALIZE_TCM_SECTIONS
|
||||||
|
//
|
||||||
|
// If defined, the .data_tcm, .text_tcm, .rodata_tcm and .bss_tcm sections
|
||||||
|
// will be initialized.
|
||||||
|
//
|
||||||
|
// INITIALIZE_USER_SECTIONS
|
||||||
|
//
|
||||||
|
// If defined, the function InitializeUserMemorySections will be called prior
|
||||||
|
// to entering main in order to allow the user to initialize any user defined
|
||||||
|
// memory sections.
|
||||||
|
//
|
||||||
|
// FULL_LIBRARY
|
||||||
|
//
|
||||||
|
// If defined then
|
||||||
|
// - argc, argv are setup by the debug_getargs.
|
||||||
|
// - the exit symbol is defined and executes on return from main.
|
||||||
|
// - the exit symbol calls destructors, atexit functions and then debug_exit.
|
||||||
|
//
|
||||||
|
// If not defined then
|
||||||
|
// - argc and argv are zero.
|
||||||
|
// - the exit symbol is defined, executes on return from main and loops
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef APP_ENTRY_POINT
|
||||||
|
#define APP_ENTRY_POINT main
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ARGSSPACE
|
||||||
|
#define ARGSSPACE 128
|
||||||
|
#endif
|
||||||
|
.syntax unified
|
||||||
|
|
||||||
|
.global _start
|
||||||
|
.extern APP_ENTRY_POINT
|
||||||
|
.global exit
|
||||||
|
.weak exit
|
||||||
|
|
||||||
|
#ifdef INITIALIZE_USER_SECTIONS
|
||||||
|
.extern InitializeUserMemorySections
|
||||||
|
#endif
|
||||||
|
|
||||||
|
.section .init, "ax"
|
||||||
|
.code 16
|
||||||
|
.align 2
|
||||||
|
.thumb_func
|
||||||
|
|
||||||
|
_start:
|
||||||
|
/* Set up main stack if size > 0 */
|
||||||
|
ldr r1, =__stack_end__
|
||||||
|
ldr r0, =__stack_start__
|
||||||
|
subs r2, r1, r0
|
||||||
|
beq 1f
|
||||||
|
#ifdef __ARM_EABI__
|
||||||
|
movs r2, #0x7
|
||||||
|
bics r1, r2
|
||||||
|
#endif
|
||||||
|
mov sp, r1
|
||||||
|
#ifdef INITIALIZE_STACK
|
||||||
|
movs r2, #0xCC
|
||||||
|
ldr r0, =__stack_start__
|
||||||
|
bl memory_set
|
||||||
|
#endif
|
||||||
|
1:
|
||||||
|
|
||||||
|
/* Set up process stack if size > 0 */
|
||||||
|
ldr r1, =__stack_process_end__
|
||||||
|
ldr r0, =__stack_process_start__
|
||||||
|
subs r2, r1, r0
|
||||||
|
beq 1f
|
||||||
|
#ifdef __ARM_EABI__
|
||||||
|
movs r2, #0x7
|
||||||
|
bics r1, r2
|
||||||
|
#endif
|
||||||
|
msr psp, r1
|
||||||
|
movs r2, #2
|
||||||
|
msr control, r2
|
||||||
|
#ifdef INITIALIZE_STACK
|
||||||
|
movs r2, #0xCC
|
||||||
|
bl memory_set
|
||||||
|
#endif
|
||||||
|
1:
|
||||||
|
|
||||||
|
/* Copy initialized memory sections into RAM (if necessary). */
|
||||||
|
ldr r0, =__data_load_start__
|
||||||
|
ldr r1, =__data_start__
|
||||||
|
ldr r2, =__data_end__
|
||||||
|
bl memory_copy
|
||||||
|
ldr r0, =__text_load_start__
|
||||||
|
ldr r1, =__text_start__
|
||||||
|
ldr r2, =__text_end__
|
||||||
|
bl memory_copy
|
||||||
|
ldr r0, =__fast_load_start__
|
||||||
|
ldr r1, =__fast_start__
|
||||||
|
ldr r2, =__fast_end__
|
||||||
|
bl memory_copy
|
||||||
|
ldr r0, =__ctors_load_start__
|
||||||
|
ldr r1, =__ctors_start__
|
||||||
|
ldr r2, =__ctors_end__
|
||||||
|
bl memory_copy
|
||||||
|
ldr r0, =__dtors_load_start__
|
||||||
|
ldr r1, =__dtors_start__
|
||||||
|
ldr r2, =__dtors_end__
|
||||||
|
bl memory_copy
|
||||||
|
ldr r0, =__rodata_load_start__
|
||||||
|
ldr r1, =__rodata_start__
|
||||||
|
ldr r2, =__rodata_end__
|
||||||
|
bl memory_copy
|
||||||
|
ldr r0, =__tdata_load_start__
|
||||||
|
ldr r1, =__tdata_start__
|
||||||
|
ldr r2, =__tdata_end__
|
||||||
|
bl memory_copy
|
||||||
|
#ifdef INITIALIZE_SECONDARY_SECTIONS
|
||||||
|
ldr r0, =__data2_load_start__
|
||||||
|
ldr r1, =__data2_start__
|
||||||
|
ldr r2, =__data2_end__
|
||||||
|
bl memory_copy
|
||||||
|
ldr r0, =__text2_load_start__
|
||||||
|
ldr r1, =__text2_start__
|
||||||
|
ldr r2, =__text2_end__
|
||||||
|
bl memory_copy
|
||||||
|
ldr r0, =__rodata2_load_start__
|
||||||
|
ldr r1, =__rodata2_start__
|
||||||
|
ldr r2, =__rodata2_end__
|
||||||
|
bl memory_copy
|
||||||
|
#endif /* #ifdef INITIALIZE_SECONDARY_SECTIONS */
|
||||||
|
#ifdef INITIALIZE_TCM_SECTIONS
|
||||||
|
ldr r0, =__data_tcm_load_start__
|
||||||
|
ldr r1, =__data_tcm_start__
|
||||||
|
ldr r2, =__data_tcm_end__
|
||||||
|
bl memory_copy
|
||||||
|
ldr r0, =__text_tcm_load_start__
|
||||||
|
ldr r1, =__text_tcm_start__
|
||||||
|
ldr r2, =__text_tcm_end__
|
||||||
|
bl memory_copy
|
||||||
|
ldr r0, =__rodata_tcm_load_start__
|
||||||
|
ldr r1, =__rodata_tcm_start__
|
||||||
|
ldr r2, =__rodata_tcm_end__
|
||||||
|
bl memory_copy
|
||||||
|
#endif /* #ifdef INITIALIZE_TCM_SECTIONS */
|
||||||
|
|
||||||
|
/* Zero the bss. */
|
||||||
|
ldr r0, =__bss_start__
|
||||||
|
ldr r1, =__bss_end__
|
||||||
|
movs r2, #0
|
||||||
|
bl memory_set
|
||||||
|
ldr r0, =__tbss_start__
|
||||||
|
ldr r1, =__tbss_end__
|
||||||
|
movs r2, #0
|
||||||
|
bl memory_set
|
||||||
|
#ifdef INITIALIZE_SECONDARY_SECTIONS
|
||||||
|
ldr r0, =__bss2_start__
|
||||||
|
ldr r1, =__bss2_end__
|
||||||
|
mov r2, #0
|
||||||
|
bl memory_set
|
||||||
|
#endif /* #ifdef INITIALIZE_SECONDARY_SECTIONS */
|
||||||
|
#ifdef INITIALIZE_TCM_SECTIONS
|
||||||
|
ldr r0, =__bss_tcm_start__
|
||||||
|
ldr r1, =__bss_tcm_end__
|
||||||
|
mov r2, #0
|
||||||
|
bl memory_set
|
||||||
|
#endif /* #ifdef INITIALIZE_TCM_SECTIONS */
|
||||||
|
|
||||||
|
/* Initialize the heap */
|
||||||
|
ldr r0, = __heap_start__
|
||||||
|
ldr r1, = __heap_end__
|
||||||
|
subs r1, r1, r0
|
||||||
|
cmp r1, #8
|
||||||
|
blt 1f
|
||||||
|
movs r2, #0
|
||||||
|
str r2, [r0]
|
||||||
|
adds r0, r0, #4
|
||||||
|
str r1, [r0]
|
||||||
|
1:
|
||||||
|
|
||||||
|
#ifdef INITIALIZE_USER_SECTIONS
|
||||||
|
ldr r2, =InitializeUserMemorySections
|
||||||
|
blx r2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Call constructors */
|
||||||
|
ldr r0, =__ctors_start__
|
||||||
|
ldr r1, =__ctors_end__
|
||||||
|
ctor_loop:
|
||||||
|
cmp r0, r1
|
||||||
|
beq ctor_end
|
||||||
|
ldr r2, [r0]
|
||||||
|
adds r0, #4
|
||||||
|
push {r0-r1}
|
||||||
|
blx r2
|
||||||
|
pop {r0-r1}
|
||||||
|
b ctor_loop
|
||||||
|
ctor_end:
|
||||||
|
|
||||||
|
/* Setup initial call frame */
|
||||||
|
movs r0, #0
|
||||||
|
mov lr, r0
|
||||||
|
mov r12, sp
|
||||||
|
|
||||||
|
.type start, function
|
||||||
|
start:
|
||||||
|
/* Jump to application entry point */
|
||||||
|
#ifdef FULL_LIBRARY
|
||||||
|
movs r0, #ARGSSPACE
|
||||||
|
ldr r1, =args
|
||||||
|
ldr r2, =debug_getargs
|
||||||
|
blx r2
|
||||||
|
ldr r1, =args
|
||||||
|
#else
|
||||||
|
movs r0, #0
|
||||||
|
movs r1, #0
|
||||||
|
#endif
|
||||||
|
ldr r2, =APP_ENTRY_POINT
|
||||||
|
blx r2
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
exit:
|
||||||
|
#ifdef FULL_LIBRARY
|
||||||
|
mov r5, r0 // save the exit parameter/return result
|
||||||
|
|
||||||
|
/* Call destructors */
|
||||||
|
ldr r0, =__dtors_start__
|
||||||
|
ldr r1, =__dtors_end__
|
||||||
|
dtor_loop:
|
||||||
|
cmp r0, r1
|
||||||
|
beq dtor_end
|
||||||
|
ldr r2, [r0]
|
||||||
|
add r0, #4
|
||||||
|
push {r0-r1}
|
||||||
|
blx r2
|
||||||
|
pop {r0-r1}
|
||||||
|
b dtor_loop
|
||||||
|
dtor_end:
|
||||||
|
|
||||||
|
/* Call atexit functions */
|
||||||
|
ldr r2, =_execute_at_exit_fns
|
||||||
|
blx r2
|
||||||
|
|
||||||
|
/* Call debug_exit with return result/exit parameter */
|
||||||
|
mov r0, r5
|
||||||
|
ldr r2, =debug_exit
|
||||||
|
blx r2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Returned from application entry point, loop forever. */
|
||||||
|
exit_loop:
|
||||||
|
b exit_loop
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
memory_copy:
|
||||||
|
cmp r0, r1
|
||||||
|
beq 2f
|
||||||
|
subs r2, r2, r1
|
||||||
|
beq 2f
|
||||||
|
1:
|
||||||
|
ldrb r3, [r0]
|
||||||
|
adds r0, r0, #1
|
||||||
|
strb r3, [r1]
|
||||||
|
adds r1, r1, #1
|
||||||
|
subs r2, r2, #1
|
||||||
|
bne 1b
|
||||||
|
2:
|
||||||
|
bx lr
|
||||||
|
|
||||||
|
.thumb_func
|
||||||
|
memory_set:
|
||||||
|
cmp r0, r1
|
||||||
|
beq 1f
|
||||||
|
strb r2, [r0]
|
||||||
|
adds r0, r0, #1
|
||||||
|
b memory_set
|
||||||
|
1:
|
||||||
|
bx lr
|
||||||
|
|
||||||
|
// default C/C++ library helpers
|
||||||
|
|
||||||
|
.macro HELPER helper_name
|
||||||
|
.section .text.\helper_name, "ax", %progbits
|
||||||
|
.global \helper_name
|
||||||
|
.weak \helper_name
|
||||||
|
\helper_name:
|
||||||
|
.thumb_func
|
||||||
|
.endm
|
||||||
|
|
||||||
|
.macro JUMPTO name
|
||||||
|
#if defined(__thumb__) && !defined(__thumb2__)
|
||||||
|
mov r12, r0
|
||||||
|
ldr r0, =\name
|
||||||
|
push {r0}
|
||||||
|
mov r0, r12
|
||||||
|
pop {pc}
|
||||||
|
#else
|
||||||
|
b \name
|
||||||
|
#endif
|
||||||
|
.endm
|
||||||
|
|
||||||
|
HELPER __aeabi_read_tp
|
||||||
|
ldr r0, =__tbss_start__-8
|
||||||
|
bx lr
|
||||||
|
HELPER __heap_lock
|
||||||
|
bx lr
|
||||||
|
HELPER __heap_unlock
|
||||||
|
bx lr
|
||||||
|
HELPER __printf_lock
|
||||||
|
bx lr
|
||||||
|
HELPER __printf_unlock
|
||||||
|
bx lr
|
||||||
|
HELPER __scanf_lock
|
||||||
|
bx lr
|
||||||
|
HELPER __scanf_unlock
|
||||||
|
bx lr
|
||||||
|
HELPER __debug_io_lock
|
||||||
|
bx lr
|
||||||
|
HELPER __debug_io_unlock
|
||||||
|
bx lr
|
||||||
|
HELPER abort
|
||||||
|
b .
|
||||||
|
HELPER __assert
|
||||||
|
b .
|
||||||
|
HELPER __aeabi_assert
|
||||||
|
b .
|
||||||
|
HELPER __cxa_pure_virtual
|
||||||
|
b .
|
||||||
|
HELPER __cxa_guard_acquire
|
||||||
|
ldr r3, [r0]
|
||||||
|
#if defined(__thumb__) && !defined(__thumb2__)
|
||||||
|
movs r0, #1
|
||||||
|
tst r3, r0
|
||||||
|
#else
|
||||||
|
tst r3, #1
|
||||||
|
#endif
|
||||||
|
beq 1f
|
||||||
|
movs r0, #0
|
||||||
|
bx lr
|
||||||
|
1:
|
||||||
|
movs r0, #1
|
||||||
|
bx lr
|
||||||
|
HELPER __cxa_guard_release
|
||||||
|
movs r3, #1
|
||||||
|
str r3, [r0]
|
||||||
|
bx lr
|
||||||
|
HELPER __cxa_guard_abort
|
||||||
|
bx lr
|
||||||
|
HELPER __sync_synchronize
|
||||||
|
bx lr
|
||||||
|
HELPER __getchar
|
||||||
|
JUMPTO debug_getchar
|
||||||
|
HELPER __putchar
|
||||||
|
JUMPTO debug_putchar
|
||||||
|
HELPER __open
|
||||||
|
JUMPTO debug_fopen
|
||||||
|
HELPER __close
|
||||||
|
JUMPTO debug_fclose
|
||||||
|
HELPER __write
|
||||||
|
mov r3, r0
|
||||||
|
mov r0, r1
|
||||||
|
movs r1, #1
|
||||||
|
JUMPTO debug_fwrite
|
||||||
|
HELPER __read
|
||||||
|
mov r3, r0
|
||||||
|
mov r0, r1
|
||||||
|
movs r1, #1
|
||||||
|
JUMPTO debug_fread
|
||||||
|
HELPER __seek
|
||||||
|
push {r4, lr}
|
||||||
|
mov r4, r0
|
||||||
|
bl debug_fseek
|
||||||
|
cmp r0, #0
|
||||||
|
bne 1f
|
||||||
|
mov r0, r4
|
||||||
|
bl debug_ftell
|
||||||
|
pop {r4, pc}
|
||||||
|
1:
|
||||||
|
ldr r0, =-1
|
||||||
|
pop {r4, pc}
|
||||||
|
// char __user_locale_name_buffer[];
|
||||||
|
.section .bss.__user_locale_name_buffer, "aw", %nobits
|
||||||
|
.global __user_locale_name_buffer
|
||||||
|
.weak __user_locale_name_buffer
|
||||||
|
__user_locale_name_buffer:
|
||||||
|
.word 0x0
|
||||||
|
|
||||||
|
#ifdef FULL_LIBRARY
|
||||||
|
.bss
|
||||||
|
args:
|
||||||
|
.space ARGSSPACE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Setup attibutes of stack and heap sections so they don't take up room in the elf file */
|
||||||
|
.section .stack, "wa", %nobits
|
||||||
|
.section .stack_process, "wa", %nobits
|
||||||
|
.section .heap, "wa", %nobits
|
||||||
|
|
||||||
152
examples/device/nrf52840/src/main.c
Normal file
152
examples/device/nrf52840/src/main.c
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@file main.c
|
||||||
|
@author hathach (tinyusb.org)
|
||||||
|
|
||||||
|
@section LICENSE
|
||||||
|
|
||||||
|
Software License Agreement (BSD License)
|
||||||
|
|
||||||
|
Copyright (c) 2013, hathach (tinyusb.org)
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. 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.
|
||||||
|
3. Neither the name of the copyright holders nor the
|
||||||
|
names of its contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||||
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
INCLUDING, BUT NOT LIMITED TO, 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.
|
||||||
|
|
||||||
|
This file is part of the tinyusb stack.
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// INCLUDE
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "bsp/board.h"
|
||||||
|
#include "tusb.h"
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// MACRO CONSTANT TYPEDEF
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// INTERNAL OBJECT & FUNCTION DECLARATION
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
void print_greeting(void);
|
||||||
|
void led_blinking_task(void);
|
||||||
|
void virtual_com_task(void);
|
||||||
|
|
||||||
|
/*------------- MAIN -------------*/
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
board_init();
|
||||||
|
print_greeting();
|
||||||
|
|
||||||
|
//tusb_init();
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
//tusb_task();
|
||||||
|
|
||||||
|
led_blinking_task();
|
||||||
|
//virtual_com_task();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void virtual_com_task(void)
|
||||||
|
{
|
||||||
|
// connected and there are data available
|
||||||
|
if ( tud_mounted(0) && tud_cdc_available(0) )
|
||||||
|
{
|
||||||
|
uint8_t buf[64];
|
||||||
|
|
||||||
|
// read and echo back
|
||||||
|
uint32_t count = tud_cdc_read(0, buf, sizeof(buf));
|
||||||
|
|
||||||
|
tud_cdc_write(0, buf, count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// tinyusb callbacks
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
void tud_mount_cb(uint8_t port)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void tud_umount_cb(uint8_t port)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void tud_cdc_rx_cb(uint8_t port)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// BLINKING TASK
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
void led_blinking_task(void)
|
||||||
|
{
|
||||||
|
enum { BLINK_INTEVAL = 1000 };
|
||||||
|
|
||||||
|
static uint32_t led_on_mask = 0;
|
||||||
|
static uint32_t last_blink = 0;
|
||||||
|
|
||||||
|
// not enough time
|
||||||
|
if ( last_blink + BLINK_INTEVAL > hal_tick_get() ) return;
|
||||||
|
|
||||||
|
last_blink += BLINK_INTEVAL;
|
||||||
|
|
||||||
|
board_leds(led_on_mask, 1 - led_on_mask);
|
||||||
|
led_on_mask = 1 - led_on_mask; // toggle
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// HELPER FUNCTION
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
void print_greeting(void)
|
||||||
|
{
|
||||||
|
char const * const rtos_name[] =
|
||||||
|
{
|
||||||
|
[TUSB_OS_NONE] = "None",
|
||||||
|
[TUSB_OS_FREERTOS] = "FreeRTOS",
|
||||||
|
};
|
||||||
|
|
||||||
|
printf("\n--------------------------------------------------------------------\n");
|
||||||
|
printf("- Device Demo (a tinyusb example)\n");
|
||||||
|
printf("- if you find any bugs or get any questions, feel free to file an\n");
|
||||||
|
printf("- issue at https://github.com/hathach/tinyusb\n");
|
||||||
|
printf("--------------------------------------------------------------------\n\n");
|
||||||
|
|
||||||
|
printf("This DEVICE demo is configured to support:");
|
||||||
|
printf(" - RTOS = %s\n", rtos_name[TUSB_CFG_OS]);
|
||||||
|
if (TUSB_CFG_DEVICE_HID_MOUSE ) puts(" - HID Mouse");
|
||||||
|
if (TUSB_CFG_DEVICE_HID_KEYBOARD ) puts(" - HID Keyboard");
|
||||||
|
if (TUSB_CFG_DEVICE_MSC ) puts(" - Mass Storage");
|
||||||
|
if (TUSB_CFG_DEVICE_CDC ) puts(" - Communication Device Class");
|
||||||
|
}
|
||||||
86
examples/device/nrf52840/src/tusb_config.h
Normal file
86
examples/device/nrf52840/src/tusb_config.h
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@file tusb_config.h
|
||||||
|
@author hathach (tinyusb.org)
|
||||||
|
|
||||||
|
@section LICENSE
|
||||||
|
|
||||||
|
Software License Agreement (BSD License)
|
||||||
|
|
||||||
|
Copyright (c) 2013, hathach (tinyusb.org)
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. 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.
|
||||||
|
3. Neither the name of the copyright holders nor the
|
||||||
|
names of its contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||||
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
INCLUDING, BUT NOT LIMITED TO, 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.
|
||||||
|
|
||||||
|
This file is part of the tinyusb stack.
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _TUSB_TUSB_CONFIG_H_
|
||||||
|
#define _TUSB_TUSB_CONFIG_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// CONTROLLER CONFIGURATION
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
//#define TUSB_CFG_MCU will be passed from IDE/command line for easy board/mcu switching
|
||||||
|
|
||||||
|
#define TUSB_CFG_CONTROLLER_0_MODE (TUSB_MODE_DEVICE)
|
||||||
|
//#define TUSB_CFG_CONTROLLER_1_MODE (TUSB_MODE_DEVICE)
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// DEVICE CONFIGURATION
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
#define TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE 64
|
||||||
|
|
||||||
|
//------------- CLASS -------------//
|
||||||
|
#define TUSB_CFG_DEVICE_HID_KEYBOARD 0
|
||||||
|
#define TUSB_CFG_DEVICE_HID_MOUSE 0
|
||||||
|
#define TUSB_CFG_DEVICE_HID_GENERIC 0 // not supported yet
|
||||||
|
#define TUSB_CFG_DEVICE_MSC 0
|
||||||
|
#define TUSB_CFG_DEVICE_CDC 1
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// COMMON CONFIGURATION
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
#define TUSB_CFG_DEBUG 2
|
||||||
|
|
||||||
|
#define TUSB_CFG_OS TUSB_OS_NONE // be passed from IDE/command line for easy project switching
|
||||||
|
//#define TUSB_CFG_OS_TASK_PRIO 0 // be passed from IDE/command line for easy project switching
|
||||||
|
#define TUSB_CFG_TICKS_HZ 1000
|
||||||
|
|
||||||
|
//#define TUSB_CFG_OS TUSB_OS_NONE
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// USB RAM PLACEMENT
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
#define TUSB_CFG_ATTR_USBRAM
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _TUSB_TUSB_CONFIG_H_ */
|
||||||
256
examples/device/nrf52840/src/tusb_descriptors.c
Normal file
256
examples/device/nrf52840/src/tusb_descriptors.c
Normal file
@@ -0,0 +1,256 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@file tusb_descriptors.c
|
||||||
|
@author hathach (tinyusb.org)
|
||||||
|
|
||||||
|
@section LICENSE
|
||||||
|
|
||||||
|
Software License Agreement (BSD License)
|
||||||
|
|
||||||
|
Copyright (c) 2013, hathach (tinyusb.org)
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. 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.
|
||||||
|
3. Neither the name of the copyright holders nor the
|
||||||
|
names of its contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||||
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
INCLUDING, BUT NOT LIMITED TO, 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.
|
||||||
|
|
||||||
|
This file is part of the tinyusb stack.
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
|
|
||||||
|
#include "tusb_descriptors.h"
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// USB DEVICE DESCRIPTOR
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
tusb_descriptor_device_t const desc_device =
|
||||||
|
{
|
||||||
|
.bLength = sizeof(tusb_descriptor_device_t),
|
||||||
|
.bDescriptorType = TUSB_DESC_TYPE_DEVICE,
|
||||||
|
.bcdUSB = 0x0200,
|
||||||
|
|
||||||
|
// Use Interface Association Descriptor (IAD) for CDC
|
||||||
|
// As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
|
||||||
|
.bDeviceClass = TUSB_CLASS_MISC,
|
||||||
|
.bDeviceSubClass = MISC_SUBCLASS_COMMON,
|
||||||
|
.bDeviceProtocol = MISC_PROTOCOL_IAD,
|
||||||
|
|
||||||
|
.bMaxPacketSize0 = TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE,
|
||||||
|
|
||||||
|
.idVendor = CFG_VENDORID,
|
||||||
|
.idProduct = CFG_PRODUCTID,
|
||||||
|
.bcdDevice = 0x0100,
|
||||||
|
|
||||||
|
.iManufacturer = 0x01,
|
||||||
|
.iProduct = 0x02,
|
||||||
|
.iSerialNumber = 0x03,
|
||||||
|
|
||||||
|
.bNumConfigurations = 0x01
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// USB COFNIGURATION DESCRIPTOR
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
app_descriptor_configuration_t const desc_configuration =
|
||||||
|
{
|
||||||
|
.configuration =
|
||||||
|
{
|
||||||
|
.bLength = sizeof(tusb_descriptor_configuration_t),
|
||||||
|
.bDescriptorType = TUSB_DESC_TYPE_CONFIGURATION,
|
||||||
|
|
||||||
|
.wTotalLength = sizeof(app_descriptor_configuration_t),
|
||||||
|
.bNumInterfaces = TOTAL_INTEFACES,
|
||||||
|
|
||||||
|
.bConfigurationValue = 1,
|
||||||
|
.iConfiguration = 0x00,
|
||||||
|
.bmAttributes = TUSB_DESC_CONFIG_ATT_BUS_POWER,
|
||||||
|
.bMaxPower = TUSB_DESC_CONFIG_POWER_MA(500)
|
||||||
|
},
|
||||||
|
|
||||||
|
// IAD points to CDC Interfaces
|
||||||
|
.cdc_iad =
|
||||||
|
{
|
||||||
|
.bLength = sizeof(tusb_descriptor_interface_association_t),
|
||||||
|
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE_ASSOCIATION,
|
||||||
|
|
||||||
|
.bFirstInterface = INTERFACE_NO_CDC,
|
||||||
|
.bInterfaceCount = 2,
|
||||||
|
|
||||||
|
.bFunctionClass = TUSB_CLASS_CDC,
|
||||||
|
.bFunctionSubClass = CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL,
|
||||||
|
.bFunctionProtocol = CDC_COMM_PROTOCOL_ATCOMMAND,
|
||||||
|
.iFunction = 0
|
||||||
|
},
|
||||||
|
|
||||||
|
//------------- CDC Communication Interface -------------//
|
||||||
|
.cdc_comm_interface =
|
||||||
|
{
|
||||||
|
.bLength = sizeof(tusb_descriptor_interface_t),
|
||||||
|
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
|
||||||
|
.bInterfaceNumber = INTERFACE_NO_CDC,
|
||||||
|
.bAlternateSetting = 0,
|
||||||
|
.bNumEndpoints = 1,
|
||||||
|
.bInterfaceClass = TUSB_CLASS_CDC,
|
||||||
|
.bInterfaceSubClass = CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL,
|
||||||
|
.bInterfaceProtocol = CDC_COMM_PROTOCOL_ATCOMMAND,
|
||||||
|
.iInterface = 0x00
|
||||||
|
},
|
||||||
|
|
||||||
|
.cdc_header =
|
||||||
|
{
|
||||||
|
.bLength = sizeof(cdc_desc_func_header_t),
|
||||||
|
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
|
||||||
|
.bDescriptorSubType = CDC_FUNC_DESC_HEADER,
|
||||||
|
.bcdCDC = 0x0120
|
||||||
|
},
|
||||||
|
|
||||||
|
.cdc_call =
|
||||||
|
{
|
||||||
|
.bLength = sizeof(cdc_desc_func_call_management_t),
|
||||||
|
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
|
||||||
|
.bDescriptorSubType = CDC_FUNC_DESC_CALL_MANAGEMENT,
|
||||||
|
.bmCapabilities = { 0 },
|
||||||
|
.bDataInterface = INTERFACE_NO_CDC+1,
|
||||||
|
},
|
||||||
|
|
||||||
|
.cdc_acm =
|
||||||
|
{
|
||||||
|
.bLength = sizeof(cdc_desc_func_abstract_control_management_t),
|
||||||
|
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
|
||||||
|
.bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT,
|
||||||
|
.bmCapabilities = { // 0x02
|
||||||
|
.support_line_request = 1,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
.cdc_union =
|
||||||
|
{
|
||||||
|
.bLength = sizeof(cdc_desc_func_union_t), // plus number of
|
||||||
|
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
|
||||||
|
.bDescriptorSubType = CDC_FUNC_DESC_UNION,
|
||||||
|
.bControlInterface = INTERFACE_NO_CDC,
|
||||||
|
.bSubordinateInterface = INTERFACE_NO_CDC+1,
|
||||||
|
},
|
||||||
|
|
||||||
|
.cdc_endpoint_notification =
|
||||||
|
{
|
||||||
|
.bLength = sizeof(tusb_descriptor_endpoint_t),
|
||||||
|
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
|
||||||
|
.bEndpointAddress = CDC_EDPT_NOTIFICATION_ADDR,
|
||||||
|
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
|
||||||
|
.wMaxPacketSize = { .size = 0x08 },
|
||||||
|
.bInterval = 0x10
|
||||||
|
},
|
||||||
|
|
||||||
|
//------------- CDC Data Interface -------------//
|
||||||
|
.cdc_data_interface =
|
||||||
|
{
|
||||||
|
.bLength = sizeof(tusb_descriptor_interface_t),
|
||||||
|
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
|
||||||
|
.bInterfaceNumber = INTERFACE_NO_CDC+1,
|
||||||
|
.bAlternateSetting = 0x00,
|
||||||
|
.bNumEndpoints = 2,
|
||||||
|
.bInterfaceClass = TUSB_CLASS_CDC_DATA,
|
||||||
|
.bInterfaceSubClass = 0,
|
||||||
|
.bInterfaceProtocol = 0,
|
||||||
|
.iInterface = 0x00
|
||||||
|
},
|
||||||
|
|
||||||
|
.cdc_endpoint_out =
|
||||||
|
{
|
||||||
|
.bLength = sizeof(tusb_descriptor_endpoint_t),
|
||||||
|
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
|
||||||
|
.bEndpointAddress = CDC_EDPT_DATA_OUT_ADDR,
|
||||||
|
.bmAttributes = { .xfer = TUSB_XFER_BULK },
|
||||||
|
.wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE },
|
||||||
|
.bInterval = 0
|
||||||
|
},
|
||||||
|
|
||||||
|
.cdc_endpoint_in =
|
||||||
|
{
|
||||||
|
.bLength = sizeof(tusb_descriptor_endpoint_t),
|
||||||
|
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
|
||||||
|
.bEndpointAddress = CDC_EDPT_DATA_IN_ADDR,
|
||||||
|
.bmAttributes = { .xfer = TUSB_XFER_BULK },
|
||||||
|
.wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE },
|
||||||
|
.bInterval = 0
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// STRING DESCRIPTORS
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
#define STRING_LEN_UNICODE(n) (2 + (2*(n))) // also includes 2 byte header
|
||||||
|
#define ENDIAN_BE16_FROM( high, low) ENDIAN_BE16(high << 8 | low)
|
||||||
|
|
||||||
|
// array of pointer to string descriptors
|
||||||
|
uint16_t const * const string_descriptor_arr [] =
|
||||||
|
{
|
||||||
|
[0] = (uint16_t []) { // supported language
|
||||||
|
ENDIAN_BE16_FROM( STRING_LEN_UNICODE(1), TUSB_DESC_TYPE_STRING ),
|
||||||
|
0x0409 // English
|
||||||
|
},
|
||||||
|
|
||||||
|
[1] = (uint16_t []) { // manufacturer
|
||||||
|
ENDIAN_BE16_FROM( STRING_LEN_UNICODE(11), TUSB_DESC_TYPE_STRING),
|
||||||
|
't', 'i', 'n', 'y', 'u', 's', 'b', '.', 'o', 'r', 'g' // len = 11
|
||||||
|
},
|
||||||
|
|
||||||
|
[2] = (uint16_t []) { // product
|
||||||
|
ENDIAN_BE16_FROM( STRING_LEN_UNICODE(14), TUSB_DESC_TYPE_STRING),
|
||||||
|
't', 'i', 'n', 'y', 'u', 's', 'b', ' ', 'd', 'e', 'v', 'i', 'c', 'e' // len = 14
|
||||||
|
},
|
||||||
|
|
||||||
|
[3] = (uint16_t []) { // serials
|
||||||
|
ENDIAN_BE16_FROM( STRING_LEN_UNICODE(4), TUSB_DESC_TYPE_STRING),
|
||||||
|
'1', '2', '3', '4' // len = 4
|
||||||
|
},
|
||||||
|
|
||||||
|
[4] = (uint16_t []) { // CDC Interface
|
||||||
|
ENDIAN_BE16_FROM( STRING_LEN_UNICODE(3), TUSB_DESC_TYPE_STRING),
|
||||||
|
'c', 'd', 'c' // len = 3
|
||||||
|
},
|
||||||
|
|
||||||
|
[5] = (uint16_t []) { // Keyboard Interface
|
||||||
|
ENDIAN_BE16_FROM( STRING_LEN_UNICODE(5), TUSB_DESC_TYPE_STRING),
|
||||||
|
'm', 'o', 'u', 's', 'e' // len = 5
|
||||||
|
},
|
||||||
|
|
||||||
|
[6] = (uint16_t []) { // Keyboard Interface
|
||||||
|
ENDIAN_BE16_FROM( STRING_LEN_UNICODE(8), TUSB_DESC_TYPE_STRING),
|
||||||
|
'k', 'e', 'y', 'b', 'o', 'a', 'r', 'd' // len = 8
|
||||||
|
},
|
||||||
|
|
||||||
|
[7] = (uint16_t []) { // MSC Interface
|
||||||
|
ENDIAN_BE16_FROM( STRING_LEN_UNICODE(3), TUSB_DESC_TYPE_STRING),
|
||||||
|
'm', 's', 'c' // len = 3
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// TINYUSB Descriptors Pointer (this variable is required by the stack)
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
tusbd_descriptor_pointer_t tusbd_descriptor_pointers =
|
||||||
|
{
|
||||||
|
.p_device = (uint8_t const * ) &desc_device,
|
||||||
|
.p_configuration = (uint8_t const * ) &desc_configuration,
|
||||||
|
.p_string_arr = (uint8_t const **) string_descriptor_arr,
|
||||||
|
};
|
||||||
101
examples/device/nrf52840/src/tusb_descriptors.h
Normal file
101
examples/device/nrf52840/src/tusb_descriptors.h
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@file tusb_descriptors.h
|
||||||
|
@author hathach (tinyusb.org)
|
||||||
|
|
||||||
|
@section LICENSE
|
||||||
|
|
||||||
|
Software License Agreement (BSD License)
|
||||||
|
|
||||||
|
Copyright (c) 2013, hathach (tinyusb.org)
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. 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.
|
||||||
|
3. Neither the name of the copyright holders nor the
|
||||||
|
names of its contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||||
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
INCLUDING, BUT NOT LIMITED TO, 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.
|
||||||
|
|
||||||
|
This file is part of the tinyusb stack.
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _TUSB_DESCRIPTORS_H_
|
||||||
|
#define _TUSB_DESCRIPTORS_H_
|
||||||
|
|
||||||
|
#include "tusb.h"
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// Descriptors Value (calculated by enabled Classes)
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
#define CFG_VENDORID 0xCAFE
|
||||||
|
//#define CFG_PRODUCTID 0x4567 // use auto product id to prevent conflict with pc's driver
|
||||||
|
|
||||||
|
// each combination of interfaces need to have a unique productid, as windows will bind & remember device driver after the first plug.
|
||||||
|
// Auto ProductID layout's Bitmap: (MSB) MassStorage | Generic | Mouse | Key | CDC (LSB)
|
||||||
|
#ifndef CFG_PRODUCTID
|
||||||
|
#define PRODUCTID_BITMAP(interface, n) ( (TUSB_CFG_DEVICE_##interface) << (n) )
|
||||||
|
#define CFG_PRODUCTID (0x4000 | ( PRODUCTID_BITMAP(CDC, 0) | PRODUCTID_BITMAP(HID_KEYBOARD, 1) | \
|
||||||
|
PRODUCTID_BITMAP(HID_MOUSE, 2) | PRODUCTID_BITMAP(HID_GENERIC, 3) | \
|
||||||
|
PRODUCTID_BITMAP(MSC, 4) ) )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define INTERFACE_NO_CDC 0
|
||||||
|
#define TOTAL_INTEFACES 2
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// Endpoints Address & Max Packet Size
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
#define EDPT_IN(x) (0x80 | (x))
|
||||||
|
#define EDPT_OUT(x) (x)
|
||||||
|
|
||||||
|
#define CDC_EDPT_NOTIFICATION_ADDR EDPT_IN (1)
|
||||||
|
#define CDC_EDPT_NOTIFICATION_PACKETSIZE 64
|
||||||
|
|
||||||
|
#define CDC_EDPT_DATA_OUT_ADDR EDPT_OUT(2)
|
||||||
|
#define CDC_EDPT_DATA_IN_ADDR EDPT_IN (2)
|
||||||
|
#define CDC_EDPT_DATA_PACKETSIZE 64
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// CONFIGURATION DESCRIPTOR
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
typedef struct ATTR_PACKED
|
||||||
|
{
|
||||||
|
tusb_descriptor_configuration_t configuration;
|
||||||
|
|
||||||
|
//------------- CDC -------------//
|
||||||
|
tusb_descriptor_interface_association_t cdc_iad;
|
||||||
|
|
||||||
|
//CDC Control Interface
|
||||||
|
tusb_descriptor_interface_t cdc_comm_interface;
|
||||||
|
cdc_desc_func_header_t cdc_header;
|
||||||
|
cdc_desc_func_call_management_t cdc_call;
|
||||||
|
cdc_desc_func_abstract_control_management_t cdc_acm;
|
||||||
|
cdc_desc_func_union_t cdc_union;
|
||||||
|
tusb_descriptor_endpoint_t cdc_endpoint_notification;
|
||||||
|
|
||||||
|
//CDC Data Interface
|
||||||
|
tusb_descriptor_interface_t cdc_data_interface;
|
||||||
|
tusb_descriptor_endpoint_t cdc_endpoint_out;
|
||||||
|
tusb_descriptor_endpoint_t cdc_endpoint_in;
|
||||||
|
|
||||||
|
} app_descriptor_configuration_t;
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -110,6 +110,8 @@
|
|||||||
#include "microbuilder/board_lpc4357usb.h"
|
#include "microbuilder/board_lpc4357usb.h"
|
||||||
#elif BOARD == BOARD_LPCLINK2
|
#elif BOARD == BOARD_LPCLINK2
|
||||||
#include "lpcxpresso/board_lpclink2.h"
|
#include "lpcxpresso/board_lpclink2.h"
|
||||||
|
#elif defined BOARD_PCA10056
|
||||||
|
#include "pca10056/board_pca10056.h"
|
||||||
#else
|
#else
|
||||||
#error BOARD is not defined or supported yet
|
#error BOARD is not defined or supported yet
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
89
hw/bsp/pca10056/board_pca10056.c
Normal file
89
hw/bsp/pca10056/board_pca10056.c
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@file board_pca10056.c
|
||||||
|
@author hathach
|
||||||
|
|
||||||
|
@section LICENSE
|
||||||
|
|
||||||
|
Software License Agreement (BSD License)
|
||||||
|
|
||||||
|
Copyright (c) 2018, hathach (tinyusb.org)
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. 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.
|
||||||
|
3. Neither the name of the copyright holders nor the
|
||||||
|
names of its contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||||
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, 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 "board_pca10056.h"
|
||||||
|
#include "nrf_gpio.h"
|
||||||
|
#include "nrf_drv_systick.h"
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------*/
|
||||||
|
/* MACRO TYPEDEF CONSTANT ENUM
|
||||||
|
*------------------------------------------------------------------*/
|
||||||
|
#define LED_1 13
|
||||||
|
#define LED_STATE_ON 0
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------*/
|
||||||
|
/* VARIABLE DECLARATION
|
||||||
|
*------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------*/
|
||||||
|
/* FUNCTION DECLARATION
|
||||||
|
*------------------------------------------------------------------*/
|
||||||
|
void board_init(void)
|
||||||
|
{
|
||||||
|
nrf_gpio_cfg_output(LED_1);
|
||||||
|
|
||||||
|
SysTick_Config(SystemCoreClock/1000);
|
||||||
|
NVIC_EnableIRQ(SysTick_IRQn);
|
||||||
|
}
|
||||||
|
|
||||||
|
void board_leds(uint32_t on_mask, uint32_t off_mask)
|
||||||
|
{
|
||||||
|
if (on_mask)
|
||||||
|
{
|
||||||
|
nrf_gpio_pin_write(LED_1, LED_STATE_ON);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( off_mask)
|
||||||
|
{
|
||||||
|
nrf_gpio_pin_write(LED_1, 1-LED_STATE_ON);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t board_buttons(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t board_uart_getchar(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void board_uart_putchar(uint8_t c)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
50
hw/bsp/pca10056/board_pca10056.h
Normal file
50
hw/bsp/pca10056/board_pca10056.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@file board_pca10056.h
|
||||||
|
@author hathach
|
||||||
|
|
||||||
|
@section LICENSE
|
||||||
|
|
||||||
|
Software License Agreement (BSD License)
|
||||||
|
|
||||||
|
Copyright (c) 2018, hathach (tinyusb.org)
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. 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.
|
||||||
|
3. Neither the name of the copyright holders nor the
|
||||||
|
names of its contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||||
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, 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.
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
|
#ifndef BOARD_PCA10056_H_
|
||||||
|
#define BOARD_PCA10056_H_
|
||||||
|
|
||||||
|
#include "nrf.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* BOARD_PCA10056_H_ */
|
||||||
98
hw/mcu/nordic/nrf52/hal/hal_nrf52.c
Normal file
98
hw/mcu/nordic/nrf52/hal/hal_nrf52.c
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@file hal_nrf52.c
|
||||||
|
@author hathach
|
||||||
|
|
||||||
|
@section LICENSE
|
||||||
|
|
||||||
|
Software License Agreement (BSD License)
|
||||||
|
|
||||||
|
Copyright (c) 2018, hathach (tinyusb.org)
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. 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.
|
||||||
|
3. Neither the name of the copyright holders nor the
|
||||||
|
names of its contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||||
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, 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 <stdbool.h>
|
||||||
|
#include "nrf.h"
|
||||||
|
#include "nrf_gpio.h"
|
||||||
|
#include "nrf_drv_systick.h"
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------*/
|
||||||
|
/* MACRO TYPEDEF CONSTANT ENUM
|
||||||
|
*------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------*/
|
||||||
|
/* VARIABLE DECLARATION
|
||||||
|
*------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------*/
|
||||||
|
/* FUNCTION DECLARATION
|
||||||
|
*------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
volatile uint32_t system_ticks = 0;
|
||||||
|
|
||||||
|
void SysTick_Handler (void)
|
||||||
|
{
|
||||||
|
system_ticks++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool hal_usb_init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void hal_usb_int_enable(uint8_t port)
|
||||||
|
{
|
||||||
|
(void) port;
|
||||||
|
NVIC_EnableIRQ(USBD_IRQn);
|
||||||
|
}
|
||||||
|
|
||||||
|
void hal_usb_int_disable(uint8_t port)
|
||||||
|
{
|
||||||
|
(void) port;
|
||||||
|
NVIC_DisableIRQ(USBD_IRQn);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t hal_tick_get(void)
|
||||||
|
{
|
||||||
|
//#define tick2ms(tck) ( ( ((uint64_t)(tck)) * 1000) / configTICK_RATE_HZ )
|
||||||
|
//return tick2ms( app_timer_cnt_get() );
|
||||||
|
|
||||||
|
return system_ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
void hal_debugger_breakpoint(void)
|
||||||
|
{
|
||||||
|
// M0 cannot check if debugger is attached or not
|
||||||
|
#if defined(__CORTEX_M) && (__CORTEX_M > 0)
|
||||||
|
// check if debugger is attached
|
||||||
|
if ( (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) == CoreDebug_DHCSR_C_DEBUGEN_Msk)
|
||||||
|
{
|
||||||
|
__asm("BKPT #0\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
@@ -53,7 +53,6 @@
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// TICK API
|
// TICK API
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
uint32_t hal_tick_get(void);
|
|
||||||
#define osal_tick_get hal_tick_get
|
#define osal_tick_get hal_tick_get
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ void hal_usb_int_enable(uint8_t port);
|
|||||||
*/
|
*/
|
||||||
void hal_usb_int_disable(uint8_t port);
|
void hal_usb_int_disable(uint8_t port);
|
||||||
|
|
||||||
|
uint32_t hal_tick_get(void);
|
||||||
|
|
||||||
// for debug only, halt mcu if assert/verify is failed if debugger is attached
|
// for debug only, halt mcu if assert/verify is failed if debugger is attached
|
||||||
void hal_debugger_breakpoint(void);
|
void hal_debugger_breakpoint(void);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user