Multiple fixes.

* Removed obsolete openocd config, use -c 'set WORKAREASIZE 0' on
devices except ST-LINK and CMSIS-DAP debugger.
* Removed logger functions due to non-reentrant logger API.
This commit is contained in:
imi415 2020-09-15 00:25:45 +08:00
parent db0a521184
commit e44c9f6664
Signed by: imi415
GPG Key ID: 17F01E106F9F5E0A
4 changed files with 13 additions and 71 deletions

View File

@ -91,9 +91,9 @@
#define configTICK_SOURCE FREERTOS_USE_RTC
#define configUSE_PREEMPTION 1
#define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
#define configUSE_TICKLESS_IDLE 1
#define configUSE_TICKLESS_IDLE 1
#define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG 1 /* See into vPortSuppressTicksAndSleep source code for explanation */
#define configCPU_CLOCK_HZ ( SystemCoreClock )
#define configTICK_RATE_HZ 1000

View File

@ -261,7 +261,7 @@
// <e> UART_CONFIG_LOG_ENABLED - Enables logging in the module.
//==========================================================
#ifndef UART_CONFIG_LOG_ENABLED
#define UART_CONFIG_LOG_ENABLED 1
#define UART_CONFIG_LOG_ENABLED 0
#endif
#if UART_CONFIG_LOG_ENABLED
// <o> UART_CONFIG_LOG_LEVEL - Default Severity level
@ -273,7 +273,7 @@
// <4=> Debug
#ifndef UART_CONFIG_LOG_LEVEL
#define UART_CONFIG_LOG_LEVEL 4
#define UART_CONFIG_LOG_LEVEL 3
#endif
// <o> UART_CONFIG_INFO_COLOR - ANSI escape code prefix.
@ -289,7 +289,7 @@
// <8=> White
#ifndef UART_CONFIG_INFO_COLOR
#define UART_CONFIG_INFO_COLOR 3
#define UART_CONFIG_INFO_COLOR 0
#endif
// <o> UART_CONFIG_DEBUG_COLOR - ANSI escape code prefix.
@ -305,7 +305,7 @@
// <8=> White
#ifndef UART_CONFIG_DEBUG_COLOR
#define UART_CONFIG_DEBUG_COLOR 6
#define UART_CONFIG_DEBUG_COLOR 0
#endif
#endif //UART_CONFIG_LOG_ENABLED
@ -505,7 +505,7 @@
// <268435456=> 57600 baud
#ifndef NRF_LOG_BACKEND_SERIAL_UART_BAUDRATE
#define NRF_LOG_BACKEND_SERIAL_UART_BAUDRATE 30924800
#define NRF_LOG_BACKEND_SERIAL_UART_BAUDRATE 251658240
#endif
// <o> NRF_LOG_BACKEND_SERIAL_UART_TX_PIN - UART TX pin

9
main.c
View File

@ -8,10 +8,13 @@
#include "nordic_common.h"
#include "sdk_errors.h"
#include "app_error.h"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "semphr.h"
#define APP_TIMER_PRESCALER 0
#define APP_TIMER_OP_QUEUE_SIZE 4
@ -20,7 +23,7 @@ TaskHandle_t xTaskBlinkLEDHandle = NULL;
void vTaskBlinkLED(void *pvParameters);
TimerHandle_t xTimerBlinkAnotherLEDHandle = NULL;
void xTimerBlinkAnotherLEDCallback(void *pvParameters);
void xTimerBlinkAnotherLEDCallback(TimerHandle_t xTimer);
int main(void) {
ret_code_t err_code;
@ -53,7 +56,7 @@ void vTaskBlinkLED(void *pvParameters) {
}
}
void xTimerBlinkAnotherLEDCallback(void *pvParameters) {
UNUSED_VARIABLE(pvParameters);
void xTimerBlinkAnotherLEDCallback(TimerHandle_t xTimer) {
UNUSED_VARIABLE(xTimer);
bsp_board_led_invert(BSP_BOARD_LED_1);
}

View File

@ -1,61 +0,0 @@
#
# script for Nordic nRF51 series, a Cortex-M0 chip
#
source [find target/swj-dp.tcl]
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME nrf51
}
if { [info exists ENDIAN] } {
set _ENDIAN $ENDIAN
} else {
set _ENDIAN little
}
# Work-area is a space in RAM used for flash programming
# By default use 16kB
if { [info exists WORKAREASIZE] } {
set _WORKAREASIZE $WORKAREASIZE
} else {
set _WORKAREASIZE 0
}
if { [info exists CPUTAPID] } {
set _CPUTAPID $CPUTAPID
} else {
set _CPUTAPID 0x0bb11477
}
swj_newdap $_CHIPNAME cpu -expected-id $_CPUTAPID
dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME cortex_m -dap $_CHIPNAME.dap
$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
if {![using_hla]} {
# The chip supports standard ARM/Cortex-M0 SYSRESETREQ signal
cortex_m reset_config sysresetreq
}
flash bank $_CHIPNAME.flash nrf51 0x00000000 0 1 1 $_TARGETNAME
flash bank $_CHIPNAME.uicr nrf51 0x10001000 0 1 1 $_TARGETNAME
#
# The chip should start up from internal 16Mhz RC, so setting adapter
# clock to 1Mhz should be OK
#
adapter speed 1000
proc enable_all_ram {} {
# nRF51822 Product Anomaly Notice (PAN) #16 explains that not all RAM banks
# are reliably enabled after reset on some revisions (contrary to spec.) So after
# resetting we enable all banks via the RAMON register
mww 0x40000524 0xF
}
$_TARGETNAME configure -event reset-end { enable_all_ram }