NRF52-DK - initial commit
This commit is contained in:
commit
c31d32ded3
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bin/
|
||||||
|
obj/
|
||||||
|
nrf5sdk/
|
||||||
|
git
|
18
.vscode/c_cpp_properties.json
vendored
Normal file
18
.vscode/c_cpp_properties.json
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Linux",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}/**",
|
||||||
|
"/usr/include/c++/8",
|
||||||
|
"/usr/include/x86_64-linux-gnu/c++/8"
|
||||||
|
],
|
||||||
|
"defines": [],
|
||||||
|
"compilerPath": "/usr/bin/gcc",
|
||||||
|
"cStandard": "c11",
|
||||||
|
"cppStandard": "c++17",
|
||||||
|
"intelliSenseMode": "clang-x64"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
50
.vscode/launch.json
vendored
Normal file
50
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Launch TCM",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/bin/nrf.elf",
|
||||||
|
"args": [],
|
||||||
|
"stopAtEntry": true,
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"environment": [],
|
||||||
|
"MIMode": "gdb",
|
||||||
|
"miDebuggerPath": "/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gdb",
|
||||||
|
"debugServerPath": "JLinkGDBServerCLExe",
|
||||||
|
"debugServerArgs": "-device nrf52832_xxaa -if swd -port 2331",
|
||||||
|
"serverStarted": "Listening on TCP/IP port 2331",
|
||||||
|
"logging": {
|
||||||
|
"engineLogging": true,
|
||||||
|
"exceptions": true,
|
||||||
|
"moduleLoad": true,
|
||||||
|
"programOutput": true,
|
||||||
|
"trace": true,
|
||||||
|
"traceResponse": true
|
||||||
|
},
|
||||||
|
"setupCommands": [
|
||||||
|
{
|
||||||
|
"description": "Enable pretty-printing for gdb.",
|
||||||
|
"text": "-enable-pretty-printing",
|
||||||
|
"ignoreFailures": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Connect to gdb server.",
|
||||||
|
"text": "target remote localhost:2331",
|
||||||
|
"ignoreFailures": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Load executable into debugger.",
|
||||||
|
"text": "file ${workspaceFolder}/bin/nrf.elf",
|
||||||
|
"ignoreFailures": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Load executable to target TCM",
|
||||||
|
"text": "load",
|
||||||
|
"ignoreFailures": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
11
.vscode/settings.json
vendored
Normal file
11
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"climits": "cpp",
|
||||||
|
"nrf_delay.h": "c",
|
||||||
|
"nrfx.h": "c",
|
||||||
|
"nrfx_config.h": "c",
|
||||||
|
"nrfx_common.h": "c",
|
||||||
|
"nrf.h": "c",
|
||||||
|
"boards.h": "c"
|
||||||
|
}
|
||||||
|
}
|
86
.vscode/tasks.json
vendored
Normal file
86
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
"options": {
|
||||||
|
"env": {
|
||||||
|
"ARCH": "posix",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "all",
|
||||||
|
"type":"shell",
|
||||||
|
"command": "make all -j8",
|
||||||
|
"problemMatcher": {
|
||||||
|
"base": "$gcc",
|
||||||
|
"owner": "gcc",
|
||||||
|
"fileLocation": [
|
||||||
|
"relative",
|
||||||
|
"${workspaceFolder}"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "flash",
|
||||||
|
"type":"shell",
|
||||||
|
"command": "make flash",
|
||||||
|
"problemMatcher": {
|
||||||
|
"base": "$gcc",
|
||||||
|
"owner": "gcc",
|
||||||
|
"fileLocation": [
|
||||||
|
"relative",
|
||||||
|
"${workspaceFolder}"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "clean",
|
||||||
|
"type":"shell",
|
||||||
|
"command": "make clean -j8",
|
||||||
|
"problemMatcher": {
|
||||||
|
"base": "$gcc",
|
||||||
|
"owner": "gcc",
|
||||||
|
"fileLocation": [
|
||||||
|
"relative",
|
||||||
|
"${workspaceFolder}"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "distclean",
|
||||||
|
"type":"shell",
|
||||||
|
"command": "make distclean",
|
||||||
|
"problemMatcher": {
|
||||||
|
"base": "$gcc",
|
||||||
|
"owner": "gcc",
|
||||||
|
"fileLocation": [
|
||||||
|
"relative",
|
||||||
|
"${workspaceFolder}"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"presentation": {
|
||||||
|
"focus": true,
|
||||||
|
"reveal": "always",
|
||||||
|
"panel": "shared",
|
||||||
|
"clear": true,
|
||||||
|
}
|
||||||
|
}
|
196
Makefile
Normal file
196
Makefile
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
CROSS_COMPILE ?= /opt/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-
|
||||||
|
|
||||||
|
TARGET_FILE ?= nrf.elf
|
||||||
|
|
||||||
|
CC = $(CROSS_COMPILE)gcc
|
||||||
|
CPP = $(CROSS_COMPILE)cpp
|
||||||
|
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||||
|
|
||||||
|
SRC_DIR = src
|
||||||
|
OBJ_DIR = obj
|
||||||
|
BIN_DIR = bin
|
||||||
|
|
||||||
|
NRF_PATH := nrf5sdk/
|
||||||
|
|
||||||
|
INCLUDES += include/
|
||||||
|
|
||||||
|
INCLUDES += $(NRF_PATH)components/
|
||||||
|
INCLUDES += $(NRF_PATH)modules/nrfx/mdk/
|
||||||
|
INCLUDES += $(NRF_PATH)components/libraries/strerror/
|
||||||
|
INCLUDES += $(NRF_PATH)components/softdevice/s132/headers/nrf52/
|
||||||
|
INCLUDES += $(NRF_PATH)components/toolchain/cmsis/include/
|
||||||
|
INCLUDES += $(NRF_PATH)components/libraries/util/
|
||||||
|
INCLUDES += $(NRF_PATH)components/libraries/balloc/
|
||||||
|
INCLUDES += $(NRF_PATH)components/libraries/ringbuf/
|
||||||
|
INCLUDES += $(NRF_PATH)modules/nrfx/hal/
|
||||||
|
INCLUDES += $(NRF_PATH)components/libraries/bsp/
|
||||||
|
INCLUDES += $(NRF_PATH)components/libraries/log/
|
||||||
|
INCLUDES += $(NRF_PATH)modules/nrfx/
|
||||||
|
INCLUDES += $(NRF_PATH)components/libraries/experimental_section_vars/
|
||||||
|
INCLUDES += $(NRF_PATH)components/softdevice/s132/headers/
|
||||||
|
INCLUDES += $(NRF_PATH)components/libraries/delay/
|
||||||
|
INCLUDES += $(NRF_PATH)integration/nrfx/
|
||||||
|
INCLUDES += $(NRF_PATH)components/libraries/atomic/
|
||||||
|
INCLUDES += $(NRF_PATH)components/boards/
|
||||||
|
INCLUDES += $(NRF_PATH)components/libraries/memobj/
|
||||||
|
INCLUDES += $(NRF_PATH)components/softdevice/common/
|
||||||
|
INCLUDES += $(NRF_PATH)external/fprintf/
|
||||||
|
INCLUDES += $(NRF_PATH)components/libraries/log/src/
|
||||||
|
|
||||||
|
CPP_FLAGS += $(addprefix -I, $(INCLUDES))
|
||||||
|
|
||||||
|
C_SRCS = $(wildcard $(SRC_DIR)/*.c)
|
||||||
|
C_OBJS = $(patsubst $(SRC_DIR)%,$(OBJ_DIR)%,$(patsubst %.c,%.o,$(C_SRCS)))
|
||||||
|
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)components/libraries/log/src/nrf_log_frontend.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)components/libraries/log/src/nrf_log_str_formatter.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)components/boards/boards.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)components/libraries/util/app_error.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)components/libraries/util/app_error_handler_gcc.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)components/libraries/util/app_error_weak.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)components/libraries/util/app_util_platform.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)components/libraries/util/nrf_assert.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)components/libraries/atomic/nrf_atomic.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)components/libraries/balloc/nrf_balloc.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)external/fprintf/nrf_fprintf.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)external/fprintf/nrf_fprintf_format.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)components/libraries/memobj/nrf_memobj.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)components/libraries/ringbuf/nrf_ringbuf.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)components/libraries/experimental_section_vars/nrf_section_iter.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)components/libraries/strerror/nrf_strerror.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)modules/nrfx/soc/nrfx_atomic.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)modules/nrfx/mdk/system_nrf52.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)components/softdevice/common/nrf_sdh.c
|
||||||
|
NRF_C_SRCS += $(NRF_PATH)components/softdevice/common/nrf_sdh_soc.c
|
||||||
|
|
||||||
|
NRF_C_OBJS = $(patsubst $(NRF_PATH)%,$(OBJ_DIR)/%,$(patsubst %.c,%.o,$(NRF_C_SRCS)))
|
||||||
|
|
||||||
|
NRF_A_SRCS = $(NRF_PATH)modules/nrfx/mdk/gcc_startup_nrf52.S
|
||||||
|
NRF_A_OBJS = $(patsubst $(NRF_PATH)%,$(OBJ_DIR)/%,$(patsubst %.S,%.o,$(NRF_A_SRCS)))
|
||||||
|
|
||||||
|
OBJS = $(NRF_A_OBJS) $(NRF_C_OBJS) $(C_OBJS)
|
||||||
|
|
||||||
|
TARGET = $(BIN_DIR)/$(TARGET_FILE)
|
||||||
|
TARGET_HEX = $(patsubst %.elf,%.hex,$(TARGET))
|
||||||
|
TARGET_PACKAGE = $(patsubst %.hex,%.zip,$(TARGET_HEX))
|
||||||
|
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
||||||
|
|
||||||
|
###################################################
|
||||||
|
OPT = 3
|
||||||
|
# C flags common to all targets
|
||||||
|
C_FLAGS += -O$(OPT) -g$(OPT)
|
||||||
|
C_FLAGS += -DBOARD_PCA10040
|
||||||
|
C_FLAGS += -DBSP_DEFINES_ONLY
|
||||||
|
C_FLAGS += -DCONFIG_GPIO_AS_PINRESET
|
||||||
|
C_FLAGS += -DFLOAT_ABI_HARD
|
||||||
|
C_FLAGS += -DNRF52
|
||||||
|
C_FLAGS += -DNRF52832_XXAA
|
||||||
|
C_FLAGS += -DNRF52_PAN_74
|
||||||
|
C_FLAGS += -DNRF_SD_BLE_API_VERSION=7
|
||||||
|
C_FLAGS += -DS132
|
||||||
|
C_FLAGS += -DSOFTDEVICE_PRESENT
|
||||||
|
C_FLAGS += -mcpu=cortex-m4
|
||||||
|
C_FLAGS += -mthumb -mabi=aapcs
|
||||||
|
C_FLAGS += -Wall -Werror
|
||||||
|
C_FLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||||
|
# keep every function in a separate section, this allows linker to discard unused ones
|
||||||
|
C_FLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
|
||||||
|
C_FLAGS += -fno-builtin -fshort-enums
|
||||||
|
|
||||||
|
# Assembler flags common to all targets
|
||||||
|
A_FLAGS += -g$(OPT)
|
||||||
|
A_FLAGS += -mcpu=cortex-m4
|
||||||
|
A_FLAGS += -mthumb -mabi=aapcs
|
||||||
|
A_FLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||||
|
A_FLAGS += -DBOARD_PCA10040
|
||||||
|
A_FLAGS += -DBSP_DEFINES_ONLY
|
||||||
|
A_FLAGS += -DCONFIG_GPIO_AS_PINRESET
|
||||||
|
A_FLAGS += -DFLOAT_ABI_HARD
|
||||||
|
A_FLAGS += -DNRF52
|
||||||
|
A_FLAGS += -DNRF52832_XXAA
|
||||||
|
A_FLAGS += -DNRF52_PAN_74
|
||||||
|
A_FLAGS += -DNRF_SD_BLE_API_VERSION=7
|
||||||
|
A_FLAGS += -DS132
|
||||||
|
A_FLAGS += -DSOFTDEVICE_PRESENT
|
||||||
|
|
||||||
|
LINKER_SCRIPT = blinky_gcc_nrf52.ld
|
||||||
|
# Linker flags
|
||||||
|
LD_FLAGS += -O$(OPT) -g$(OPT)
|
||||||
|
LD_FLAGS += -mthumb -mabi=aapcs -L$(NRF_PATH)modules/nrfx/mdk -T$(LINKER_SCRIPT)
|
||||||
|
LD_FLAGS += -mcpu=cortex-m4
|
||||||
|
LD_FLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||||
|
# let linker dump unused sections
|
||||||
|
LD_FLAGS += -Wl,--gc-sections
|
||||||
|
# use newlib in nano version
|
||||||
|
LD_FLAGS += --specs=nano.specs
|
||||||
|
|
||||||
|
C_FLAGS += -D__HEAP_SIZE=8192
|
||||||
|
C_FLAGS += -D__HEAP_SIZE=8192
|
||||||
|
|
||||||
|
A_FLAGS += -D__HEAP_SIZE=8192
|
||||||
|
A_FLAGS += -D__HEAP_SIZE=8192
|
||||||
|
|
||||||
|
# Add standard libraries at the very end of the linker input, after all objects
|
||||||
|
# that may need symbols provided by these libraries.
|
||||||
|
LIBS += c nosys m
|
||||||
|
###################################################
|
||||||
|
|
||||||
|
.PHONY: all install uninstall clean distclean debug package flash
|
||||||
|
all: $(TARGET)
|
||||||
|
|
||||||
|
debug:
|
||||||
|
@echo $(TARGET_HEX)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(TARGET) $(TARGET_HEX) $(TARGET_PACKAGE)
|
||||||
|
rm -f $(OBJS) $(patsubst %.o,%.d,$(OBJS))
|
||||||
|
|
||||||
|
distclean:
|
||||||
|
rm -rf $(OBJ_DIR) $(BIN_DIR)
|
||||||
|
|
||||||
|
package: $(TARGET_HEX) $(THIS_MAKEFILE)
|
||||||
|
nrfutil pkg generate --hw-version 52 --application-version 1 --application $(TARGET_HEX) --sd-req 0xCB --sd-id 0xCB --key-file keys/private.key $(TARGET_PACKAGE)
|
||||||
|
|
||||||
|
flash: $(TARGET_HEX) $(THIS_MAKEFILE)
|
||||||
|
@echo Flashing: $(TARGET_HEX)
|
||||||
|
nrfjprog -f nrf52 --program $(TARGET_HEX) --sectorerase
|
||||||
|
nrfjprog -f nrf52 --reset
|
||||||
|
|
||||||
|
flash_softdevice:
|
||||||
|
@echo Flashing: $(NRF_PATH)/components/softdevice/s132/hex/s132_nrf52_7.0.1_softdevice.hex
|
||||||
|
nrfjprog -f nrf52 --program $(NRF_PATH)/components/softdevice/s132/hex/s132_nrf52_7.0.1_softdevice.hex --sectorerase
|
||||||
|
nrfjprog -f nrf52 --reset
|
||||||
|
|
||||||
|
erase:
|
||||||
|
nrfjprog -f nrf52 --eraseall
|
||||||
|
|
||||||
|
$(TARGET): $(OBJS) $(THIS_MAKEFILE)
|
||||||
|
@mkdir -p $(BIN_DIR)
|
||||||
|
$(CC) $(CC_FLAGS) $(LD_FLAGS) $(OBJS) $(addprefix -l,$(LIBS)) -o $@
|
||||||
|
|
||||||
|
$(TARGET_HEX): $(TARGET) $(THIS_MAKEFILE)
|
||||||
|
$(OBJCOPY) -O ihex $(TARGET) $(TARGET_HEX)
|
||||||
|
|
||||||
|
$(OBJ_DIR)/%.d: $(SRC_DIR)/%.c
|
||||||
|
@mkdir -p $(OBJ_DIR)/
|
||||||
|
$(CPP) -MM -MF $@ -MP -MT $(patsubst %.d,%.o,$@) $(C_FLAGS) $(CPP_FLAGS) $(patsubst $(OBJ_DIR)/%.d,$(SRC_DIR)/%.c,$@)
|
||||||
|
|
||||||
|
$(OBJ_DIR)/%.d: $(NRF_PATH)/%.S
|
||||||
|
@mkdir -p $(OBJ_DIR)/
|
||||||
|
$(CPP) -MM -MF $@ -MP -MT $(patsubst %.d,%.o,$@) $(C_FLAGS) $(CPP_FLAGS) $(patsubst $(OBJ_DIR)/%.d,$(NRF_PATH)/%.S,$@)
|
||||||
|
|
||||||
|
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
|
||||||
|
@mkdir -p $(OBJ_DIR)/
|
||||||
|
$(CC) -c $(CPP_FLAGS) $(C_FLAGS) $< -o $@
|
||||||
|
|
||||||
|
$(OBJ_DIR)/%.o: $(NRF_PATH)/%.c
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
$(CC) -std=c99 -MP -MD -c -o $@ $< $(C_FLAGS) $(CPP_FLAGS)
|
||||||
|
|
||||||
|
$(OBJ_DIR)/%.o: $(NRF_PATH)/%.S
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
$(CC) -c $(ASMFLAGS) $< -o $@
|
||||||
|
|
||||||
|
ifneq ($(MAKECMDGOALS),clean)
|
||||||
|
-include $(patsubst %.o,%.d,$(OBJS))
|
||||||
|
endif
|
88
blinky_gcc_nrf52.ld
Normal file
88
blinky_gcc_nrf52.ld
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
/* Linker script to configure memory regions. */
|
||||||
|
|
||||||
|
SEARCH_DIR(.)
|
||||||
|
GROUP(-lgcc -lc -lnosys)
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0x5a000
|
||||||
|
RAM (rwx) : ORIGIN = 0x20005968, LENGTH = 0xa698
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
.mem_section_dummy_ram :
|
||||||
|
{
|
||||||
|
}
|
||||||
|
.log_dynamic_data :
|
||||||
|
{
|
||||||
|
PROVIDE(__start_log_dynamic_data = .);
|
||||||
|
KEEP(*(SORT(.log_dynamic_data*)))
|
||||||
|
PROVIDE(__stop_log_dynamic_data = .);
|
||||||
|
} > RAM
|
||||||
|
.log_filter_data :
|
||||||
|
{
|
||||||
|
PROVIDE(__start_log_filter_data = .);
|
||||||
|
KEEP(*(SORT(.log_filter_data*)))
|
||||||
|
PROVIDE(__stop_log_filter_data = .);
|
||||||
|
} > RAM
|
||||||
|
|
||||||
|
} INSERT AFTER .data;
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.mem_section_dummy_rom :
|
||||||
|
{
|
||||||
|
}
|
||||||
|
.sdh_soc_observers :
|
||||||
|
{
|
||||||
|
PROVIDE(__start_sdh_soc_observers = .);
|
||||||
|
KEEP(*(SORT(.sdh_soc_observers*)))
|
||||||
|
PROVIDE(__stop_sdh_soc_observers = .);
|
||||||
|
} > FLASH
|
||||||
|
.sdh_state_observers :
|
||||||
|
{
|
||||||
|
PROVIDE(__start_sdh_state_observers = .);
|
||||||
|
KEEP(*(SORT(.sdh_state_observers*)))
|
||||||
|
PROVIDE(__stop_sdh_state_observers = .);
|
||||||
|
} > FLASH
|
||||||
|
.sdh_stack_observers :
|
||||||
|
{
|
||||||
|
PROVIDE(__start_sdh_stack_observers = .);
|
||||||
|
KEEP(*(SORT(.sdh_stack_observers*)))
|
||||||
|
PROVIDE(__stop_sdh_stack_observers = .);
|
||||||
|
} > FLASH
|
||||||
|
.sdh_req_observers :
|
||||||
|
{
|
||||||
|
PROVIDE(__start_sdh_req_observers = .);
|
||||||
|
KEEP(*(SORT(.sdh_req_observers*)))
|
||||||
|
PROVIDE(__stop_sdh_req_observers = .);
|
||||||
|
} > FLASH
|
||||||
|
.log_const_data :
|
||||||
|
{
|
||||||
|
PROVIDE(__start_log_const_data = .);
|
||||||
|
KEEP(*(SORT(.log_const_data*)))
|
||||||
|
PROVIDE(__stop_log_const_data = .);
|
||||||
|
} > FLASH
|
||||||
|
.log_backends :
|
||||||
|
{
|
||||||
|
PROVIDE(__start_log_backends = .);
|
||||||
|
KEEP(*(SORT(.log_backends*)))
|
||||||
|
PROVIDE(__stop_log_backends = .);
|
||||||
|
} > FLASH
|
||||||
|
.nrf_balloc :
|
||||||
|
{
|
||||||
|
PROVIDE(__start_nrf_balloc = .);
|
||||||
|
KEEP(*(.nrf_balloc))
|
||||||
|
PROVIDE(__stop_nrf_balloc = .);
|
||||||
|
} > FLASH
|
||||||
|
|
||||||
|
} INSERT AFTER .text
|
||||||
|
|
||||||
|
|
||||||
|
INCLUDE "nrf_common.ld"
|
3347
include/sdk_config.h
Normal file
3347
include/sdk_config.h
Normal file
File diff suppressed because it is too large
Load Diff
34
interface/driver.h
Normal file
34
interface/driver.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef __DRIVER_H__
|
||||||
|
#define __DRIVER_H__
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
struct driver;
|
||||||
|
|
||||||
|
typedef int (*fp_open_t)(const struct driver *);
|
||||||
|
typedef int (*fp_close_t)(const struct driver *);
|
||||||
|
typedef int (*fp_read_t)(const struct driver *, char *, unsigned int);
|
||||||
|
typedef int (*fp_write_t)(const struct driver *, const char *, unsigned int);
|
||||||
|
typedef int (*fp_ioctl_t)(const struct driver *, unsigned int, unsigned int argc, va_list);
|
||||||
|
|
||||||
|
struct driver_fp {
|
||||||
|
fp_open_t open;
|
||||||
|
fp_close_t close;
|
||||||
|
fp_read_t read;
|
||||||
|
fp_write_t write;
|
||||||
|
fp_ioctl_t ioctl;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct driver {
|
||||||
|
const char *name;
|
||||||
|
const struct driver_fp *fp;
|
||||||
|
const void *dev;
|
||||||
|
};
|
||||||
|
|
||||||
|
int drv_open(const struct driver *drv);
|
||||||
|
int drv_close(const struct driver *drv);
|
||||||
|
int drv_read(const struct driver *drv, char *buffer, unsigned int length);
|
||||||
|
int drv_write(const struct driver *drv, const char *buffer, unsigned int length);
|
||||||
|
int drv_ioctl(const struct driver *drv, unsigned int cmd, unsigned int argc, ...);
|
||||||
|
|
||||||
|
#endif
|
13
nrf_sdk.sh
Executable file
13
nrf_sdk.sh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SDK_FOLDER=nrf5sdk
|
||||||
|
SDK_COTAINER=nRF5SDK160098a08e2.zip
|
||||||
|
SDK_URL=https://www.nordicsemi.com/-/media/Software-and-other-downloads/SDKs/nRF5/Binaries/$SDK_COTAINER
|
||||||
|
|
||||||
|
rm -rf $SDK_FOLDER
|
||||||
|
mkdir $SDK_FOLDER
|
||||||
|
curl $SDK_URL -o $SDK_FOLDER/$SDK_COTAINER
|
||||||
|
cd $SDK_FOLDER
|
||||||
|
unzip $SDK_COTAINER
|
||||||
|
rm $SDK_COTAINER
|
||||||
|
cd -
|
77
src/main.c
Normal file
77
src/main.c
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2014 - 2019, 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, except as embedded into a Nordic
|
||||||
|
* Semiconductor ASA integrated circuit in a product or a software update for
|
||||||
|
* such product, 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.
|
||||||
|
*
|
||||||
|
* 4. This software, with or without modification, must only be used with a
|
||||||
|
* Nordic Semiconductor ASA integrated circuit.
|
||||||
|
*
|
||||||
|
* 5. Any software provided in binary form under this license must not be reverse
|
||||||
|
* engineered, decompiled, modified and/or disassembled.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
|
||||||
|
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
* OF MERCHANTABILITY, NONINFRINGEMENT, 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/** @file
|
||||||
|
*
|
||||||
|
* @defgroup blinky_example_main main.c
|
||||||
|
* @{
|
||||||
|
* @ingroup blinky_example
|
||||||
|
* @brief Blinky Example Application main file.
|
||||||
|
*
|
||||||
|
* This file contains the source code for a sample application to blink LEDs.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "nrf_delay.h"
|
||||||
|
#include "boards.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Function for application main entry.
|
||||||
|
*/
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
/* Configure board. */
|
||||||
|
bsp_board_init(BSP_INIT_LEDS);
|
||||||
|
|
||||||
|
/* Toggle LEDs. */
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
bsp_board_led_invert(i);
|
||||||
|
nrf_delay_ms(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@}
|
||||||
|
**/
|
Loading…
Reference in New Issue
Block a user