# FreeRTOS Flash demo port to nrf51822+softdevice
## Description
This is a port of the simple FreeRTOS blinky demo. Critical region
handling has been updated to use the softdevice api.
Due to a lack of SysTick hardware in the nrf51 the tick timer is
implemented via RTC1. RTC1 auses the LFCLK; so we don't need HFCLK
running most of the time.
The vApplicationIdleHook is implemented to call sd_app_evt_wait(). So
it ought to sleep as well as can be expected.
## Questionable Decisions + Todos
I've cleared the portDISABLE_INTERRUPT macros. Most of FreeRTOS seems to use the critical region code which ought to be right... but there may be some code that still believes that it's disabling interrupts directly (when it is not).
CPSID/CPSIE Fun:
If CPSID is called in for an extended period of time, then the radio
will miss it's deadlines. Eventually,
the correct way to handle these may be to store/restore a mask of enabled
application interrupts (excluding those blocked or restricted by the
sd) and sprinkle it around as needed. You would think that the
sd_nvic_critical_region_enter would do something like this, however in
SDK 6.0.0 there is only a stub, leaving us to wonder how this is
implemented in the softdevice blob.
port.c(ulSetInterruptMaskFromISR):
Removed cpsid before the branch. There was no complimentary cspie in
the vClearInterruptMaskFromISR. These functions seem to set and clear PRIMASK directly, which is a no-no for nrf51 with sd running. I've cleared the macros by which these functions are referenced with no ill-effects. They are left in the code in case some day it proves a better idea to clear / set ICSR as mentioned above.
port.c(xPortPendSVHandler):
I commented out the cspid/cspie bookending
the branch to vTaskSwitchContext. This would seem like a "bad idea",
but the logic in that function has nothing to do with the actual
context switch. It's more of a hook for stack overflow testing and
the trace framework. Could be bad news for task stats and the
like. No practical effect on my projects yet.
I've reduced the default call stack size to the 1596B required for softdevice operation (0x600 down from 0xC00). Task
stacks are allocated from the heap, but if you add a lot of functionality
outside tasks (anything running in Handler mode or using MSP...BLE event handlers, perhaps ) then you'll need to increase
the stack in startup_nrf51.s (and decrease the configTOTAL_HEAP_SIZE
in FreeRTOSConfig.h). There's only ~3kB of RAM left after the s120
softdevice has it's way (it uses 10K+1.5K stack); so memory will be
tight. Careful application design is needed.
Patches welcome, this code is PoC quality (at best).
## Prerequisites
- GCC ARM Toolchain (arm-eabi-none-gcc, et. al) in your path
- NRF SDK installed locally and the path specified as SDK_PATH in the
Makefile
- NRF Softdevice loaded onto the development board.
- Tested with s120v1, NRF51822 SDK 6.1.0, and arm gcc 4.8 2014q2
## Usage
1. Edit Makefile as needed. You'll also want to correct the LED_0
definition in main.c to correspond to your development boards LED.
2. Flash softdevice
3. `make flash`
## Credits
- Build environment based heavily on
[hlnd/nrf51-pure-gcc-setup](https://github.com/hlnd/nrf51-pure-gcc-setup)
- Heavily influenced by the existing FreeRTOS Flash Demo and the existing FreeRTOS ARM_CM0 code.
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
FreeRTOS8.0.1-nrf51-softdevice-master.zip (73个子文件)
FreeRTOS8.0.1-nrf51-softdevice-master
FreeRTOSConfig.h 6KB
main.c 7KB
include
QueueOverwrite.h 4KB
flash_timer.h 4KB
partest.h 4KB
comtest2.h 4KB
PollQ.h 4KB
print.h 4KB
TimerDemo.h 4KB
stdint.readme 850B
blocktim.h 4KB
semphr.h 33KB
AltBlckQ.h 4KB
mpu_wrappers.h 7KB
projdefs.h 4KB
AltQTest.h 4KB
dynamic.h 4KB
croutine.h 28KB
timers.h 52KB
comtest_strings.h 4KB
BlockQ.h 4KB
QueueSet.h 4KB
flop.h 4KB
FreeRTOS.h 24KB
flash.h 4KB
countsem.h 4KB
crhook.h 4KB
mevents.h 4KB
comtest.h 4KB
crflash.h 4KB
EventGroupsDemo.h 4KB
semtest.h 4KB
list.h 17KB
QPeek.h 4KB
IntQueue.h 4KB
GenQTest.h 4KB
integer.h 4KB
AltBlock.h 4KB
fileIO.h 4KB
death.h 4KB
recmutex.h 4KB
StackMacros.h 9KB
portable.h 12KB
serial.h 5KB
AltPollQ.h 4KB
queue.h 61KB
event_groups.h 28KB
task.h 59KB
src
portable
GCC
NRF51_SD
portmacro.h 6KB
port.c 13KB
MemMang
heap_4.c 16KB
heap_2.c 12KB
heap_1.c 7KB
heap_3.c 5KB
list.c 9KB
queue.c 73KB
croutine.c 15KB
timers.c 33KB
tasks.c 115KB
event_groups.c 23KB
.gitignore 21B
Makefile 853B
README.md 3KB
template
gcc_nrf51_common.ld 3KB
Makefile.posix 3KB
gcc_nrf51_s210.ld 286B
gcc_nrf51_blank.ld 208B
gcc_nrf51_s120.ld 281B
gcc_nrf51_s310.ld 283B
Makefile 3KB
gcc_nrf51_s110.ld 279B
Makefile.windows 1KB
startup_nrf51.s 8KB
共 73 条
- 1
wkong501
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页