基于IAR移植sdk12.2.0建立nrf52832的工程———GPIO
工程伊始,需要在sdk包中拷贝三个重要的文件,blinky_iar_nRF5x.icf,iar_startup_nrf52.s,system_nrf52.c。
工程目录建立:
1、建立bsp文件,包括了开发板相关的头文件,开发板用PCA10040,
2、把sdk中的components目录中的drivers_nrf、libraries、device、toolchain,以及sdk_validation.h文件拷贝到自己建立的目录中,
3、建立project目录,用于放iar的工程文件,其中,RTE文件存放一些底层的文件,具体可以参考下面的罗列出来的详细的目录树。

文件夹 PATH 列表
卷序列号为 523663A7 7005:0F54
D:.
│ dir.txt
│
└─LED
├─bsp
│ boards.h
│ bsp.c
│ bsp.h
│ bsp_btn_ble.c
│ bsp_btn_ble.h
│ n5_starterkit.h
│ pca10028.h
│ pca10031.h
│ pca10040.h
│
├─components
│ │ sdk_validation.h
│ │
│ ├─device
│ │ compiler_abstraction.h
│ │ nrf.h
│ │ nrf51.h
│ │ nrf51422_peripherals.h
│ │ nrf51802_peripherals.h
│ │ nrf51822_peripherals.h
│ │ nrf51_bitfields.h
│ │ nrf51_deprecated.h
│ │ nrf51_to_nrf52.h
│ │ nrf51_to_nrf52840.h
│ │ nrf52.h
│ │ nrf52832_peripherals.h
│ │ nrf52840.h
│ │ nrf52840_bitfields.h
│ │ nrf52840_peripherals.h
│ │ nrf52_bitfields.h
│ │ nrf52_name_change.h
│ │ nrf52_to_nrf52840.h
│ │
│ ├─drivers_nrf
│ │ ├─adc
│ │ │ nrf_drv_adc.c
│ │ │ nrf_drv_adc.h
│ │ │
│ │ ├─ble_flash
│ │ │ ble_flash.c
│ │ │ ble_flash.h
│ │ │
│ │ ├─clock
│ │ │ nrf_drv_clock.c
│ │ │ nrf_drv_clock.h
│ │ │
│ │ ├─common
│ │ │ nrf_drv_common.c
│ │ │ nrf_drv_common.h
│ │ │
│ │ ├─comp
│ │ │ nrf_drv_comp.c
│ │ │ nrf_drv_comp.h
│ │ │
│ │ ├─config
│ │ │ nrf_drv_config.h
│ │ │ nrf_drv_config_validation.h
│ │ │
│ │ ├─delay
│ │ │ nrf_delay.c
│ │ │ nrf_delay.h
│ │ │
│ │ ├─gpiote
│ │ │ nrf_drv_gpiote.c
│ │ │ nrf_drv_gpiote.h
│ │ │
│ │ ├─hal
│ │ │ nrf_adc.c
│ │ │ nrf_adc.h
│ │ │ nrf_clock.h
│ │ │ nrf_comp.h
│ │ │ nrf_ecb.c
│ │ │ nrf_ecb.h
│ │ │ nrf_egu.h
│ │ │ nrf_gpio.h
│ │ │ nrf_gpiote.h
│ │ │ nrf_i2s.h
│ │ │ nrf_lpcomp.h
│ │ │ nrf_nvmc.c
│ │ │ nrf_nvmc.h
│ │ │ nrf_pdm.h
│ │ │ nrf_ppi.h
│ │ │ nrf_pwm.h
│ │ │ nrf_qdec.h
│ │ │ nrf_rng.h
│ │ │ nrf_rtc.h
│ │ │ nrf_saadc.c
│ │ │ nrf_saadc.h
│ │ │ nrf_spi.h
│ │ │ nrf_spim.h
│ │ │ nrf_spis.h
│ │ │ nrf_temp.h
│ │ │ nrf_timer.h
│ │ │ nrf_twi.h
│ │ │ nrf_twim.h
│ │ │ nrf_twis.h
│ │ │ nrf_uart.h
│ │ │ nrf_uarte.h
│ │ │ nrf_wdt.h
│ │ │
│ │ ├─i2s
│ │ │ nrf_drv_i2s.c
│ │ │ nrf_drv_i2s.h
│ │ │
│ │ ├─lpcomp
│ │ │ nrf_drv_lpcomp.c
│ │ │ nrf_drv_lpcomp.h
│ │ │
│ │ ├─nrf_soc_nosd
│ │ │ nrf_error.h
│ │ │ nrf_nvic.c
│ │ │ nrf_nvic.h
│ │ │ nrf_soc.c
│ │ │ nrf_soc.h
│ │ │
│ │ ├─pdm
│ │ │ nrf_drv_pdm.c
│ │ │ nrf_drv_pdm.h
│ │ │
│ │ ├─ppi
│ │ │ nrf_drv_ppi.c
│ │ │ nrf_drv_ppi.h
│ │ │
│ │ ├─pstorage
│ │ │ │ pstorage.c
│ │ │ │ pstorage.h
│ │ │ │ pstorage_nosd.c
│ │ │ │ pstorage_raw.c
│ │ │ │
│ │ │ └─config
│ │ │ pstorage_platform.h
│ │ │
│ │ ├─pwm
│ │ │ nrf_drv_pwm.c
│ │ │ nrf_drv_pwm.h
│ │ │
│ │ ├─qdec
│ │ │ nrf_drv_qdec.c
│ │ │ nrf_drv_qdec.h
│ │ │
│ │ ├─radio_config
│ │ │ radio_config.c
│ │ │ radio_config.h
│ │ │
│ │ ├─rng
│ │ │ nrf_drv_rng.c
│ │ │ nrf_drv_rng.h
│ │ │
│ │ ├─rtc
│ │ │ nrf_drv_rtc.c
│ │ │ nrf_drv_rtc.h
│ │ │
│ │ ├─saadc
│ │ │ nrf_drv_saadc.c
│ │ │ nrf_drv_saadc.h
│ │ │
│ │ ├─sdio
│ │ │ │ sdio.c
│ │ │ │ sdio.h
│ │ │ │
│ │ │ └─config
│ │ │ sdio_config.h
│ │ │
│ │ ├─spi_master
│ │ │ nrf_drv_spi.c
│ │ │ nrf_drv_spi.h
│ │ │ spi_5W_master.c
│ │ │ spi_5W_master.h
│ │ │
│ │ ├─spi_slave
│ │ │ nrf_drv_spis.c
│ │ │ nrf_drv_spis.h
│ │ │
│ │ ├─swi
│ │ │ nrf_drv_swi.c
│ │ │ nrf_drv_swi.h
│ │ │
│ │ ├─timer
│ │ │ nrf_drv_timer.c
│ │ │ nrf_drv_timer.h
│ │ │
│ │ ├─twis_slave
│ │ │ nrf_drv_twis.c
│ │ │ nrf_drv_twis.h
│ │ │ nrf_drv_twis_inst.def
│ │ │
│ │ ├─twi_master
│ │ │ │ nrf_drv_twi.c
│ │ │ │ nrf_drv_twi.h
│ │ │ │
│ │ │ └─deprecated
│ │ │ │ twi_hw_master.c
│ │ │ │ twi_master.h
│ │ │ │ twi_sw_master.c
│ │ │ │
│ │ │ └─config
│ │ │ twi_master_config.h
│ │ │
│ │ ├─uart
│ │ │ nrf_drv_uart.c
│ │ │ nrf_drv_uart.h
│ │ │
│ │ └─wdt
│ │ nrf_drv_wdt.c
│ │ nrf_drv_wdt.h
│ │
│ ├─libraries
│ │ ├─bootloader_dfu
│ │ │ │ bootloader.c
│ │ │ │ bootloader.h
│ │ │ │ bootloader_settings.c
│ │ │ │ bootloader_settings.h
│ │ │ │ bootloader_types.h
│ │ │ │ bootloader_util.c
│ │ │ │ bootloader_util.h
│ │ │ │ dfu.h
│ │ │ │ dfu_app_handler.c
│ │ │ │ dfu_app_handler.h
│ │ │ │ dfu_bank_internal.h
│ │ │ │ dfu_ble_svc.h
│ │ │ │ dfu_ble_svc_internal.h
│ │ │ │ dfu_dual_bank.c
│ │ │ │ dfu_init.h
│ │ │ │ dfu_init_template.c
│ │ │ │ dfu_single_bank.c
│ │ │ │ dfu_transport.h
│ │ │ │ dfu_transport_ble.c
│ │ │ │ dfu_transport_serial.c
│ │ │ │ dfu_types.h
│ │ │ │
│ │ │ ├─ble_transport
│ │ │ │ hci_mem_pool_internal.h
│ │ │ │
│ │ │ ├─experimental
│ │ │ │ dfu_init_template_signing.c
│ │ │ │ nrf_sec.h
│ │ │ │
│ │ │ └─hci_transport
│ │ │ hci_mem_pool_internal.h
│ │ │ hci_transport_config.h
│ │ │
│ │ ├─button
│ │ │ app_button.c
│ │ │ app_button.h
│ │ │
│ │ ├─crc16
│ │ │ crc16.c
│ │ │ crc16.h
│ │ │
│ │ ├─crc32
│ │ │ crc32.c
│ │ │ crc32.h
│ │ │
│ │ ├─ecc
│ │ │ ecc.c
│ │ │ ecc.h
│ │ │
│ │ ├─experimental_section_vars
│ │ │ section_vars.h
│ │ │
│ │ ├─fds
│ │ │ │ fds.c
│ │ │ │ fds.h
│ │ │ │ fds_internal_defs.h
│ │ │ │
│ │ │ └─config
│ │ │ fds_config.h
│ │ │
│ │ ├─fifo
│ │ │ app_fifo.c
│ │ │ app_fifo.h
│ │ │
│ │ ├─fstorage
│ │ │ │ fstorage.c
│ │ │ │ fstorage.h
│ │ │ │ fstorage_internal_defs.h
│ │ │ │ fstorage_nosd.c
│ │ │ │
│ │ │ └─config
│ │ │ fstorage_config.h
│ │ │
│ │ ├─gpiote
│ │ │ app_gpiote.c
│ │ │ app_gpiote.h
│ │ │ app_gpiote_fast_detect.c
│ │ │
│ │ ├─hardfault
│ │ │ │ hardfault.h
│ │ │ │ hardfault_implementation.c
│ │ │ │
│ │ │ ├─nrf51
│ │ │ │ └─handler
│ │ │ │ hardfault_handler_gcc.c
│ │ │ │ hardfault_handler_iar.c
│ │ │ │ hardfault_handler_keil.c
│ │ │ │
│ │ │ └─nrf52
│ │ │ └─handler
│ │ │ hardfault_handler_gcc.c
│ │ │ hardfault_handler_iar.c
│ │ │ hardfault_handler_keil.c
│ │ │
│ │ ├─hci
│ │ │ │ hci_mem_pool.c
│ │ │ │ hci_mem_pool.h
│ │ │ │ hci_slip.c
│ │ │ │ hci_slip.h
│ │ │ │ hci_transport.c
│ │ │ │ hci_transport.h
│ │ │ │
│ │ │ └─config
│ │ │ hci_mem_pool_internal.h
│ │ │ hci_transport_config.h
│ │ │
│ │ ├─ic_info
│ │ │ nrf_ic_info.c
│ │ │ nrf_ic_info.h
│ │ │
│ │ ├─led_softblink
│ │ │ led_softblink.c
│ │ │ led_softblink.h
│ │ │
│ │ ├─low_power_pwm
│ │ │ low_power_pwm.c
│ │ │ low_power_pwm.h
│ │ │
│ │ ├─mailbox
│ │ │ app_mailbox.c
│ │ │ app_mailbox.h
│ │ │ app_mailbox_local.h
│ │ │
│ │ ├─mem_manager
│ │ │ mem_manager.c
│ │ │ mem_manager.h
│ │ │
│ │ ├─pwm
│ │ │ app_pwm.c
│ │ │ app_pwm.h
│ │ │
│ │ ├─scheduler
│ │ │ app_scheduler.c
│ │ │ app_scheduler.h
│ │ │ app_scheduler_serconn.c
│ │ │
│ │ ├─sensorsim
│ │ │ sensorsim.c
│ │ │ sensorsim.h
│ │ │
│ │ ├─sha256
│ │ │ sha256.c
│ │ │ sha256.h
│ │ │
│ │ ├─simple_timer
│ │ │ app_simple_timer.c
│ │ │ app_simple_timer.h
│ │ │
│ │ ├─slip
│ │ │ slip.c
│ │ │ slip.h
│ │ │
│ │ ├─timer
│ │ │ app_timer.c
│ │ │ app_timer.h
│ │ │ app_timer_appsh.c
│ │ │ app_timer_appsh.h
│ │ │ app_timer_ble_gzll.c
│ │ │ app_timer_freertos.c
│ │ │ app_timer_rtx.c
│ │ │
│ │ ├─trace
│ │ │ app_trace.c
│ │ │ app_trace.h
│ │ │
│ │ ├─twi
│ │ │ app_twi.c
│ │ │ app_twi.h
│ │ │
│ │ ├─uart
│ │ │ app_uart.c
│ │ │ app_uart.h
│ │ │ app_uart_fifo.c
│ │ │ retarget.c
│ │ │
│ │ └─util
│ │ app_error.c
│ │ app_error.h
│ │ app_error_weak.c
│ │ app_error_weak.h
│ │ app_util.h
│ │ app_util_bds.h
│ │ app_util_platform.c
│ │ app_util_platform.h
│ │ common.h
│ │ nordic_common.h
│ │ nrf_assert.c
│ │ nrf_assert.h
│ │ nrf_log.c
│ │ nrf_log.h
│ │ sdk_common.h
│ │ sdk_errors.h
│ │ sdk_macros.h
│ │ sdk_mapped_flags.c
│ │ sdk_mapped_flags.h
│ │ sdk_os.h
│ │ sdk_resources.h
│ │
│ └─toolchain
│ │ system_nrf51.c
│ │ system_nrf51.h
│ │ system_nrf51422.c
│ │ system_nrf52.c
│ │ system_nrf52.h
│ │ system_nrf52840.c
│ │ system_nrf52840.h
│ │
│ ├─arm
│ │ arm_startup_nrf51.s
│ │ arm_startup_nrf52.s
│ │ arm_startup_nrf52840.s
│ │ uicr_config.h
│ │
│ ├─cmsis
│ │ ├─dsp
│ │ │ │ license.txt
│ │ │ │
│ │ │ ├─ARM
│ │ │ │ arm_cortexM4lf_math.lib
│ │ │ │ arm_cortexM4l_math.lib
│ │ │ │
│ │ │ └─GCC
│ │ │ libarm_cortexM4lf_math.a
│ │ │ libarm_cortexM4l_math.a
│ │ │
│ │ └─include
│ │ arm_common_tables.h
│ │ arm_const_structs.h
│ │ arm_math.h
│ │ cmsis_armcc.h
│ │ cmsis_armcc_V6.h
│ │ cmsis_gcc.h
│ │ core_cm0.h
│ │ core_cm0plus.h
│ │ core_cm3.h
│ │ core_cm4.h
│ │ core_cm7.h
│ │ core_cmFunc.h
│ │ core_cmInstr.h
│ │ core_cmSimd.h
│ │ core_sc000.h
│ │ core_sc300.h
│ │
│ ├─gcc
│ │ file_list.mk
│ │ gcc_nrf51_common.ld
│ │ gcc_startup_nrf51.S
│ │ gcc_startup_nrf52.S
│ │ gcc_startup_nrf52840.S
│ │ Makefile.common
│ │ Makefile.posix
│ │ Makefile.windows
│ │ nrf51_common.ld
│ │ nrf51_xxaa.ld
│ │ nrf51_xxab.ld
│ │ nrf51_xxac.ld
│ │ nrf52840_xxaa.ld
│ │ nrf52_common.ld
│ │ nrf52_xxaa.ld
│ │ nrf5x_common.ld
│ │
│ └─iar
│ iar_nrf51_blank_xxaa.icf
│ iar_nrf51_blank_xxac.icf
│ iar_startup_nrf51.s
│ iar_startup_nrf52.s
│ iar_startup_nrf52840.s
│
└─project
│ JLinkLog.txt
│ JLinkSettings.ini
│ led.dep
│ LED.emProject
│ LED.emSession
│ led.ewd
│ led.ewp
│ led.ewt
│ LED.eww
│ LED.uvguix.liming
│ LED.uvoptx
│ LED.uvprojx
│ main.c
│
├─Debug
│ ├─Exe
│ │ led.hex
│ │ led.out
│ │ led.sim
│ │
│ ├─List
│ │ led.map
│ │
│ └─Obj
│ iar_startup_nrf52.o
│ led.pbd
│ led.pbd.browse
│ led.pbd.linf
│ main.o
│ main.pbi
│ main.pbi.xcl
│ nrf_delay.o
│ nrf_delay.pbi
│ nrf_delay.pbi.xcl
│ system_nrf52.o
│ system_nrf52.pbi
│ system_nrf52.pbi.xcl
│
├─Listings
│ arm_startup_nrf52.lst
│ led.map
│
├─Objects
│ arm_startup_nrf52.d
│ arm_startup_nrf52.o
│ ExtDll.iex
│ led.axf
│ led.build_log.htm
│ led.hex
│ led.htm
│ led.lnp
│ led.sct
│ LED_nrf52832_xxaa.dep
│ main.crf
│ main.d
│ main.o
│ nrf_delay.crf
│ nrf_delay.d
│ nrf_delay.o
│ system_nrf52.crf
│ system_nrf52.d
│ system_nrf52.o
│
├─Output
│ └─LED nrf52832_xxaa
│ └─Obj
├─RTE
│ │ RTE_Components.h
│ │ system_nrf52.h
│ │
│ └─Device
│ └─nRF52832_xxAA
│ arm_startup_nrf52.s
│ blinky_iar_nRF5x.icf
│ iar_startup_nrf52.s
│ ses_nrf51_startup.s
│ ses_nrf52_startup.s
│ system_nrf52.c
│
└─settings
led.crun
led.Debug.cspy.bat
led.Debug.cspy.ps1
led.Debug.driver.xcl
led.Debug.general.xcl
led.dnx
LED.wsdt
led_Debug.jlink
首先,需要blinky_iar_nRF5x.icf文件,这个名称可以修改的,sdk里面根据不同的工程起了不同的文件名,但是内容是一样的。我的目录放在$PROJ_DIR$\RTE\Device\nRF52832_xxAA\blinky_iar_nRF5x.icf,在linker选项中就填上面的路径,如下图所示:

其次,需要iar_startup_nrf52.s,和icf文件同一个目录,是汇编启动文件,和stm32的启动文件和类似的。
再次需要system_nrf52.c,里面实现了始终初始化的函数。即iar_startup_nrf52.s先执行,后执行system_nrf52.c,该文件在toolchain目录中,最后执行main函数。
建立Wordspace,建立project,各目录如下所示:

最后,需要对工程进行配置,右键options



头文件路径如下:

$PROJ_DIR$\RTE\Device\nRF52832_xxAA\
$PROJ_DIR$\RTE
$PROJ_DIR$\..\bsp
$PROJ_DIR$\..\components\drivers_nrf\delay
$PROJ_DIR$\..\components\drivers_nrf\hal
$PROJ_DIR$\..\components\drivers_nrf\common
$PROJ_DIR$\..\components\drivers_nrf\uart
$PROJ_DIR$\..\components\drivers_nrf\config
$PROJ_DIR$\..\components\drivers_nrf\nrf_soc_nosd
$PROJ_DIR$\..\components\libraries\uart
$PROJ_DIR$\..\components\libraries\util
$PROJ_DIR$\..\components\libraries\fifo
$PROJ_DIR$\..\components\device
$PROJ_DIR$\..\components
$PROJ_DIR$\..\components\toolchain
$PROJ_DIR$\..\components\toolchain\cmsis\include
宏定义如下
BSP_DEFINES_ONLY
BOARD_PCA10040
NRF52
每个定义如下所示:


最后编译,下载工程hex文件,ok了。此文,参考了艾克姆科技的文档,再此表示感谢。

基于IAR移植sdk12.2.0建立nrf52832的工程———GPIO的更多相关文章
- 基于IAR和STM32的uCOS-II移植
网上基于MDK的移植数不胜数,但是基于IAR的移植几乎没有,因为官方的例程就是基于IAR的,所以移植起来很简单,没人介绍,但还是得小心谨慎,一不小心就出错,对于新手来说,查找错误可不是那么容易的.IA ...
- 在IAR平台建立STC8ASK64S4A12单片机工程
转载:http://www.51hei.com/bbs/forum.php?mod=viewthread&tid=168481&page=1#pid737250 一般我们使用STC单 ...
- 基于Abp React前端的项目建立与运行——React框架分析
基于Abp React前端的项目建立与运行 目录 基于Abp React前端的项目建立与运行 1 Abp项目配置 2 运行WebApi后端项目 2.1 创建C3D数据库,并且将数据库对应链接字符串替换 ...
- [MFC] VS2013版本MFC工程移植到VC6.0上
:VS虽号称“宇宙最强IDE”,但是有时候安装包太大,动不动就几个G:而且安装好之后也会多出很多几乎很难用到的部分,这对于那些处女座的人如何忍受!本文不是吐槽,而是给出一种在应急场景下,不用安装新版本 ...
- 基于MDK的ARM-GCC开发环境建立及新唐M0的HID类设备的C++开发
一,下载安装测试arm-none-eabi-gcc编译工具链 1,查看arm-none-eabi-gcc编译工具版本 打开网页:https://sourcery.mentor.com/G ...
- 用VSCode开发一个基于asp.net core 2.0/sql server linux(docker)/ng5/bs4的项目(1)
最近使用vscode比较多. 学习了一下如何在mac上使用vscode开发asp.netcore项目. 这里是我写的关于vscode的一篇文章: https://www.cnblogs.com/cgz ...
- 乐鑫esp8266的 基于Nonos移植红外线1883,实现遥控器控制
代码地址如下:http://www.demodashi.com/demo/12613.html 一.前言. 距离上篇的8266进阶博文有那么一段时间了,那么本文带来的是基于Nonos的红外线H1838 ...
- 《Linux设备驱动开发具体解释(第3版)》(即《Linux设备驱动开发具体解释:基于最新的Linux 4.0内核》)网购链接
<Linux设备驱动开发具体解释:基于最新的Linux 4.0内核> china-pub spm=a1z10.3-b.w4011-10017777404.30.kvceXB&i ...
- WebApplicationInitializer究 Spring 3.1之无web.xml式 基于代码配置的servlet3.0应用
本文转自http://hitmit1314.iteye.com/blog/1315816 大家应该都已经知道Spring 3.1对无web.xml式基于代码配置的servlet3.0应用.通过spri ...
随机推荐
- Flask (七) 部署
阿里云部署Flask项目 部署Flask项目和部署Django项目基本一致,我们也使用uwsgi+nginx 我们在部署Django项目基础上部署Flask项目 1, 将uwsgi.ini ...
- HDU1087(树状数组求LIS)
题是水题,学习一下用树状数组求LIS. 先离散化一下,注意去重:然后就把a[i]作为下标,dp[i]作为值,max作为维护的运算插进树状数组即可. 如果是上升子序列,询问(a[i] - 1):如果是不 ...
- 转 查看磁盘IO负载 - 看哪些进程在读写磁盘 以及oracle 异步I/O 和同步I/O
https://www.cnblogs.com/cloudstorage/archive/2012/11/11/2764623.html #####sample 1: Oracle等待事件db fil ...
- 表单辅助函数-form_open()
使用from_open()之前需要装载本辅助函数: $this->load->helper('form'); php===> echo form_open('email/send') ...
- Top-Down和Bottom-Up位图的区别
Top-Down vs. Bottom-Up DIBs If you are new to graphics programming, you might expect that a bitmap w ...
- Spring框架学习——AOP的开发
一.AOP开发中的相关术语. ——JoinPoint(连接点):指那些可以被拦截到的点.比如增删改查方法都可以增强,这些方法就可以被称为是连接点. ——PointCut:切入点,真正被拦截的点,指对哪 ...
- spark常用参数
val conf = new SparkConf().setAppName("WordCount_groupBy").setMaster("local") // ...
- 【extjs6学习笔记】0.2 准备:类库结构
- Eclipse介绍
Eclipse是著名的跨平台开源集成开发环境(IDE).最初主要用来Java语言开发.Eclipse的本身只是一个框架平台,通过插件使其作为C/C++.Python.PHP等其他语言的开发工具.Ecl ...
- eclipse的hadoop插件对集群操作提示org.apache.hadoop.security.AccessControlException:Permission denied
eclipse的hadoop插件对集群操作提示org.apache.hadoop.security.AccessControlException:Permission denied: user = z ...