Merge pull request #107 from andrzej-kaczmarek/npl-nrf5sdk-revert

Revert "porting: Add FreeRTOS on nRF5 SDK porting example"
This commit is contained in:
Andrzej Kaczmarek
2018-05-24 00:29:58 +02:00
committed by GitHub
11 changed files with 0 additions and 7825 deletions
-5
View File
@@ -1,8 +1,3 @@
# Dummy NPL build
*.o
/porting/examples/dummy/dummy
# nRF5 SDK build
/porting/examples/freertos_nrf5_sdk/nrf5_sdk
/porting/examples/freertos_nrf5_sdk/pca10040/blank/armgcc/_build/
/porting/examples/freertos_nrf5_sdk/pca10056/blank/armgcc/_build/
-126
View File
@@ -1,126 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
*
* http://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.
*/
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include "FreeRTOS.h"
#include "task.h"
#include "nimble/nimble_port.h"
#include "host/ble_hs.h"
#include "host/util/util.h"
#include "services/gap/ble_svc_gap.h"
#include "services/gatt/ble_svc_gatt.h"
static const char gap_name[] = "FreeRTOS NimBLE";
static uint8_t own_addr_type;
static void start_advertise(void);
static void
put_ad(uint8_t ad_type, uint8_t ad_len, const void *ad, uint8_t *buf,
uint8_t *len)
{
buf[(*len)++] = ad_len + 1;
buf[(*len)++] = ad_type;
memcpy(&buf[*len], ad, ad_len);
*len += ad_len;
}
static void
update_ad(void)
{
uint8_t ad[BLE_HS_ADV_MAX_SZ];
uint8_t ad_len = 0;
uint8_t ad_flags = BLE_HS_ADV_F_DISC_GEN | BLE_HS_ADV_F_BREDR_UNSUP;
put_ad(BLE_HS_ADV_TYPE_FLAGS, 1, &ad_flags, ad, &ad_len);
put_ad(BLE_HS_ADV_TYPE_COMP_NAME, sizeof(gap_name), gap_name, ad, &ad_len);
ble_gap_adv_set_data(ad, ad_len);
}
static int
gap_event_cb(struct ble_gap_event *event, void *arg)
{
switch (event->type) {
case BLE_GAP_EVENT_CONNECT:
if (event->connect.status) {
start_advertise();
}
break;
case BLE_GAP_EVENT_DISCONNECT:
start_advertise();
break;
}
return 0;
}
static void
start_advertise(void)
{
struct ble_gap_adv_params advp;
int rc;
update_ad();
memset(&advp, 0, sizeof advp);
advp.conn_mode = BLE_GAP_CONN_MODE_UND;
advp.disc_mode = BLE_GAP_DISC_MODE_GEN;
rc = ble_gap_adv_start(own_addr_type, NULL, BLE_HS_FOREVER,
&advp, gap_event_cb, NULL);
assert(rc == 0);
}
static void
app_ble_sync_cb(void)
{
int rc;
rc = ble_hs_util_ensure_addr(0);
assert(rc == 0);
rc = ble_hs_id_infer_auto(0, &own_addr_type);
assert(rc == 0);
start_advertise();
}
void
nimble_host_task(void *param)
{
ble_hs_cfg.sync_cb = app_ble_sync_cb;
/* Enable GAP and GATT services */
ble_svc_gap_init();
ble_svc_gatt_init();
ble_svc_gap_device_name_set(gap_name);
while (1) {
ble_npl_eventq_run(ble_npl_eventq_dflt_get());
}
}
@@ -1,207 +0,0 @@
/*
* FreeRTOS Kernel V10.0.0
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software. If you wish to use our Amazon
* FreeRTOS name, please do so in a fair use way that does not cause confusion.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H
#ifdef SOFTDEVICE_PRESENT
#include "nrf_soc.h"
#endif
#include "app_util_platform.h"
/*-----------------------------------------------------------
* Possible configurations for system timer
*/
#define FREERTOS_USE_RTC 0 /**< Use real time clock for the system */
#define FREERTOS_USE_SYSTICK 1 /**< Use SysTick timer for system */
/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/
#define configTICK_SOURCE FREERTOS_USE_RTC
#define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 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 1024
#define configMAX_PRIORITIES ( 3 )
#define configMINIMAL_STACK_SIZE ( 60 )
#define configTOTAL_HEAP_SIZE ( 8192 )
#define configMAX_TASK_NAME_LEN ( 4 )
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_ALTERNATIVE_API 0 /* Deprecated! */
#define configQUEUE_REGISTRY_SIZE 2
#define configUSE_QUEUE_SETS 0
#define configUSE_TIME_SLICING 0
#define configUSE_NEWLIB_REENTRANT 0
#define configENABLE_BACKWARD_COMPATIBILITY 1
/* Hook function related definitions. */
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#define configCHECK_FOR_STACK_OVERFLOW 0
#define configUSE_MALLOC_FAILED_HOOK 0
/* Run time and task stats gathering related definitions. */
#define configGENERATE_RUN_TIME_STATS 0
#define configUSE_TRACE_FACILITY 0
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Software timer definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( 2 )
#define configTIMER_QUEUE_LENGTH 32
#define configTIMER_TASK_STACK_DEPTH ( 80 )
/* Tickless Idle configuration. */
#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
/* Tickless idle/low power functionality. */
/* Define to trap errors during development. */
#if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER)
#define configASSERT( x ) ASSERT(x)
#endif
/* FreeRTOS MPU specific definitions. */
#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 1
/* Optional functions - most linkers will remove unused functions anyway. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_xResumeFromISR 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_xTaskGetCurrentTaskHandle 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_xTaskGetIdleTaskHandle 1
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1
#define INCLUDE_pcTaskGetTaskName 1
#define INCLUDE_eTaskGetState 1
#define INCLUDE_xEventGroupSetBitFromISR 1
#define INCLUDE_xTimerPendFunctionCall 1
/* The lowest interrupt priority that can be used in a call to a "set priority"
function. */
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf
/* The highest interrupt priority that can be used by any interrupt service
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY _PRIO_APP_HIGH
/* Interrupt priorities used by the kernel port layer itself. These are generic
to all Cortex-M ports, and do not rely on any particular library functions. */
#define configKERNEL_INTERRUPT_PRIORITY configLIBRARY_LOWEST_INTERRUPT_PRIORITY
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
standard names - or at least those used in the unmodified vector table. */
#define vPortSVCHandler SVC_Handler
#define xPortPendSVHandler PendSV_Handler
/*-----------------------------------------------------------
* Settings that are generated automatically
* basing on the settings above
*/
#if (configTICK_SOURCE == FREERTOS_USE_SYSTICK)
// do not define configSYSTICK_CLOCK_HZ for SysTick to be configured automatically
// to CPU clock source
#define xPortSysTickHandler SysTick_Handler
#elif (configTICK_SOURCE == FREERTOS_USE_RTC)
#define configSYSTICK_CLOCK_HZ ( 32768UL )
#define xPortSysTickHandler RTC1_IRQHandler
#else
#error Unsupported configTICK_SOURCE value
#endif
/* Code below should be only used by the compiler, and not the assembler. */
#if !(defined(__ASSEMBLY__) || defined(__ASSEMBLER__))
#include "nrf.h"
#include "nrf_assert.h"
/* This part of definitions may be problematic in assembly - it uses definitions from files that are not assembly compatible. */
/* Cortex-M specific definitions. */
#ifdef __NVIC_PRIO_BITS
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
#define configPRIO_BITS __NVIC_PRIO_BITS
#else
#error "This port requires __NVIC_PRIO_BITS to be defined"
#endif
/* Access to current system core clock is required only if we are ticking the system by systimer */
#if (configTICK_SOURCE == FREERTOS_USE_SYSTICK)
#include <stdint.h>
extern uint32_t SystemCoreClock;
#endif
#endif /* !assembler */
/** Implementation note: Use this with caution and set this to 1 ONLY for debugging
* ----------------------------------------------------------
* Set the value of configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to below for enabling or disabling RTOS tick auto correction:
* 0. This is default. If the RTC tick interrupt is masked for more than 1 tick by higher priority interrupts, then most likely
* one or more RTC ticks are lost. The tick interrupt inside RTOS will detect this and make a correction needed. This is needed
* for the RTOS internal timers to be more accurate.
* 1. The auto correction for RTOS tick is disabled even though few RTC tick interrupts were lost. This feature is desirable when debugging
* the RTOS application and stepping though the code. After stepping when the application is continued in debug mode, the auto-corrections of
* RTOS tick might cause asserts. Setting configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to 1 will make RTC and RTOS go out of sync but could be
* convenient for debugging.
*/
#define configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG 0
#endif /* FREERTOS_CONFIG_H */
File diff suppressed because it is too large Load Diff
-128
View File
@@ -1,128 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
*
* http://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.
*/
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include "FreeRTOS.h"
#include "task.h"
#include "nrf_drv_clock.h"
#include "nimble/nimble_port.h"
static TaskHandle_t nimble_host_task_h;
static TaskHandle_t nimble_ctrl_task_h;
static uint32_t radio_isr_addr;
static uint32_t rng_isr_addr;
static uint32_t rtc0_isr_addr;
/* Some interrupt handlers required for NimBLE radio driver */
void
RADIO_IRQHandler(void)
{
((void (*)(void))radio_isr_addr)();
}
void
RNG_IRQHandler(void)
{
((void (*)(void))rng_isr_addr)();
}
void
RTC0_IRQHandler(void)
{
((void (*)(void))rtc0_isr_addr)();
}
/* This is called by NimBLE radio driver to set interrupt handlers */
void
npl_freertos_hw_set_isr(int irqn, uint32_t addr)
{
switch (irqn) {
case RADIO_IRQn:
radio_isr_addr = addr;
break;
case RNG_IRQn:
rng_isr_addr = addr;
break;
case RTC0_IRQn:
rtc0_isr_addr = addr;
break;
}
}
uint32_t
npl_freertos_hw_enter_critical(void)
{
uint32_t ctx = __get_PRIMASK();
__disable_irq();
return (ctx & 0x01);
}
void
npl_freertos_hw_exit_critical(uint32_t ctx)
{
if (!ctx) {
__enable_irq();
}
}
int
main(void)
{
extern void nimble_host_task(void *arg);
ret_code_t err_code;
/* Initialize clock driver for better time accuracy in FREERTOS */
err_code = nrf_drv_clock_init();
APP_ERROR_CHECK(err_code);
/* Initialize NimBLE porting layer */
nimble_port_init();
/*
* Create task where NimBLE host will run. It is not strictly necessary to
* have separate task for NimBLE host, but since something needs to handle
* default queue it is just easier to make separate task which does this.
*/
xTaskCreate(nimble_host_task, "nh", configMINIMAL_STACK_SIZE + 400,
NULL, tskIDLE_PRIORITY + 1, &nimble_host_task_h);
/*
* Create task where NimBLE LL will run. This one is required as LL has its
* own event queue and should have highest priority. The task function is
* provided by NimBLE and in case of FreeRTOS it does not need to be wrapped
* since it has compatible prototype.
*/
xTaskCreate(nimble_port_ll_task_func, "nc", configMINIMAL_STACK_SIZE + 400,
NULL, configMAX_PRIORITIES - 1, &nimble_ctrl_task_h);
vTaskStartScheduler();
/* We should never reach this code */
assert(0);
while (true) {
}
}
@@ -1,187 +0,0 @@
PROJECT_NAME := nimble_FreeRTOS_pca10040
TARGETS := nrf52832_xxaa
OUTPUT_DIRECTORY := _build
PROJ_DIR := ../../..
SDK_ROOT ?= $(PROJ_DIR)/nrf5_sdk
$(OUTPUT_DIRECTORY)/nrf52832_xxaa.out: \
LINKER_SCRIPT := nimble_FreeRTOS_gcc_nrf52.ld
# Source files common to all targets
SRC_FILES += \
$(SDK_ROOT)/modules/nrfx/mdk/gcc_startup_nrf52.S \
$(SDK_ROOT)/components/boards/boards.c \
$(SDK_ROOT)/external/freertos/source/croutine.c \
$(SDK_ROOT)/external/freertos/source/event_groups.c \
$(SDK_ROOT)/external/freertos/source/portable/MemMang/heap_1.c \
$(SDK_ROOT)/external/freertos/source/list.c \
$(SDK_ROOT)/external/freertos/portable/GCC/nrf52/port.c \
$(SDK_ROOT)/external/freertos/portable/CMSIS/nrf52/port_cmsis.c \
$(SDK_ROOT)/external/freertos/portable/CMSIS/nrf52/port_cmsis_systick.c \
$(SDK_ROOT)/external/freertos/source/queue.c \
$(SDK_ROOT)/external/freertos/source/stream_buffer.c \
$(SDK_ROOT)/external/freertos/source/tasks.c \
$(SDK_ROOT)/external/freertos/source/timers.c \
$(SDK_ROOT)/components/libraries/button/app_button.c \
$(SDK_ROOT)/components/libraries/util/app_error.c \
$(SDK_ROOT)/components/libraries/util/app_error_handler_gcc.c \
$(SDK_ROOT)/components/libraries/util/app_error_weak.c \
$(SDK_ROOT)/components/libraries/timer/app_timer_freertos.c \
$(SDK_ROOT)/components/libraries/util/app_util_platform.c \
$(SDK_ROOT)/components/libraries/util/nrf_assert.c \
$(SDK_ROOT)/components/libraries/strerror/nrf_strerror.c \
$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_clock.c \
$(SDK_ROOT)/components/drivers_nrf/nrf_soc_nosd/nrf_nvic.c \
$(SDK_ROOT)/components/drivers_nrf/nrf_soc_nosd/nrf_soc.c \
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_clock.c \
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_gpiote.c \
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_power_clock.c \
$(SDK_ROOT)/components/libraries/bsp/bsp.c \
$(PROJ_DIR)/main.c \
$(PROJ_DIR)/ble.c \
$(SDK_ROOT)/modules/nrfx/mdk/system_nrf52.c \
# Include folders common to all targets
INC_FOLDERS += \
$(PROJ_DIR)/config \
$(SDK_ROOT)/components \
$(SDK_ROOT)/modules/nrfx/mdk \
$(SDK_ROOT)/components/libraries/experimental_log \
$(PROJ_DIR) \
$(SDK_ROOT)/components/libraries/timer \
$(SDK_ROOT)/components/libraries/strerror \
$(SDK_ROOT)/components/toolchain/cmsis/include \
$(SDK_ROOT)/external/freertos/source/include \
$(SDK_ROOT)/external/freertos/config \
$(SDK_ROOT)/components/libraries/util \
../config \
$(SDK_ROOT)/components/libraries/balloc \
$(SDK_ROOT)/modules/nrfx/hal \
$(SDK_ROOT)/components/libraries/bsp \
$(SDK_ROOT)/components/libraries/button \
$(SDK_ROOT)/modules/nrfx \
$(SDK_ROOT)/components/libraries/experimental_section_vars \
$(SDK_ROOT)/integration/nrfx/legacy \
$(SDK_ROOT)/external/freertos/portable/CMSIS/nrf52 \
$(SDK_ROOT)/components/libraries/experimental_log/src \
$(SDK_ROOT)/integration/nrfx \
$(SDK_ROOT)/components/drivers_nrf/nrf_soc_nosd \
$(SDK_ROOT)/components/boards \
$(SDK_ROOT)/components/libraries/experimental_memobj \
$(SDK_ROOT)/external/freertos/portable/GCC/nrf52 \
$(SDK_ROOT)/modules/nrfx/drivers/include \
# Libraries common to all targets
LIB_FILES += \
# Optimization flags
OPT = -Og -g3
# Uncomment the line below to enable link time optimization
#OPT += -flto
# C flags common to all targets
CFLAGS += $(OPT)
CFLAGS += -DBOARD_PCA10040
CFLAGS += -DCONFIG_GPIO_AS_PINRESET
CFLAGS += -DFLOAT_ABI_HARD
CFLAGS += -DFREERTOS
CFLAGS += -DNRF52
CFLAGS += -DNRF52832_XXAA
CFLAGS += -DNRF52_PAN_74
CFLAGS += -mcpu=cortex-m4
CFLAGS += -mthumb -mabi=aapcs
CFLAGS += -Wall -Werror
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
# keep every function in a separate section, this allows linker to discard unused ones
CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
CFLAGS += -fno-builtin -fshort-enums
# C++ flags common to all targets
CXXFLAGS += $(OPT)
# Assembler flags common to all targets
ASMFLAGS += -g3
ASMFLAGS += -mcpu=cortex-m4
ASMFLAGS += -mthumb -mabi=aapcs
ASMFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
ASMFLAGS += -DBOARD_PCA10040
ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET
ASMFLAGS += -DFLOAT_ABI_HARD
ASMFLAGS += -DFREERTOS
ASMFLAGS += -DNRF52
ASMFLAGS += -DNRF52832_XXAA
ASMFLAGS += -DNRF52_PAN_74
# Linker flags
LDFLAGS += $(OPT)
LDFLAGS += -mthumb -mabi=aapcs -L$(SDK_ROOT)/modules/nrfx/mdk -T$(LINKER_SCRIPT)
LDFLAGS += -mcpu=cortex-m4
LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
# let linker dump unused sections
LDFLAGS += -Wl,--gc-sections
# use newlib in nano version
LDFLAGS += --specs=nano.specs
nrf52832_xxaa: CFLAGS += -D__HEAP_SIZE=8192
nrf52832_xxaa: CFLAGS += -D__STACK_SIZE=8192
nrf52832_xxaa: ASMFLAGS += -D__HEAP_SIZE=8192
nrf52832_xxaa: ASMFLAGS += -D__STACK_SIZE=8192
# Add standard libraries at the very end of the linker input, after all objects
# that may need symbols provided by these libraries.
LIB_FILES += -lc -lnosys -lm
# Configure NimBLE variables
NIMBLE_ROOT := $(PROJ_DIR)/../../..
NIMBLE_CFG_CONTROLLER := 1
NIMBLE_CFG_TINYCRYPT := 1
include $(NIMBLE_ROOT)/porting/nimble/Makefile.defs
# Add NimBLE CFLAGS
CFLAGS += $(NIMBLE_CFLAGS)
# Add NPL for FreeRTOS, UART HCI transport for nRF5 SDK and all NimBLE sources
SRC_FILES += \
$(NIMBLE_ROOT)/porting/npl/freertos/src/npl_os_freertos.c \
$(NIMBLE_SRC) \
# Add NPL for FreeRTOS and all NimBLE directories to include paths
INC_FOLDERS += \
$(PROJ_DIR)/include \
$(NIMBLE_ROOT)/porting/npl/freertos/include \
$(NIMBLE_INCLUDE) \
.PHONY: default help
# Default target - first one defined
default: nrf52832_xxaa
# Print all targets that can be built
help:
@echo following targets are available:
@echo nrf52832_xxaa
@echo sdk_config - starting external tool for editing sdk_config.h
@echo flash - flashing binary
TEMPLATE_PATH := $(SDK_ROOT)/components/toolchain/gcc
include $(TEMPLATE_PATH)/Makefile.common
$(foreach target, $(TARGETS), $(call define_target, $(target)))
.PHONY: flash erase
# Flash the program
flash: $(OUTPUT_DIRECTORY)/nrf52832_xxaa.hex
@echo Flashing: $<
nrfjprog -f nrf52 --program $< --sectorerase
nrfjprog -f nrf52 --reset
erase:
nrfjprog -f nrf52 --eraseall
SDK_CONFIG_FILE := ../config/sdk_config.h
CMSIS_CONFIG_TOOL := $(SDK_ROOT)/external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar
sdk_config:
java -jar $(CMSIS_CONFIG_TOOL) $(SDK_CONFIG_FILE)
@@ -1,51 +0,0 @@
/* Linker script to configure memory regions. */
SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)
MEMORY
{
FLASH (rx) : ORIGIN = 0x0, LENGTH = 0x80000
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x10000
}
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
} INSERT AFTER .data;
SECTIONS
{
.mem_section_dummy_rom :
{
}
.log_const_data :
{
PROVIDE(__start_log_const_data = .);
KEEP(*(SORT(.log_const_data*)))
PROVIDE(__stop_log_const_data = .);
} > FLASH
.nrf_balloc :
{
PROVIDE(__start_nrf_balloc = .);
KEEP(*(.nrf_balloc))
PROVIDE(__stop_nrf_balloc = .);
} > FLASH
} INSERT AFTER .text
INCLUDE "nrf_common.ld"
File diff suppressed because it is too large Load Diff
@@ -1,184 +0,0 @@
PROJECT_NAME := freertos_FreeRTOS_pca10056
TARGETS := nrf52840_xxaa
OUTPUT_DIRECTORY := _build
PROJ_DIR := ../../..
SDK_ROOT ?= $(PROJ_DIR)/nrf5_sdk
$(OUTPUT_DIRECTORY)/nrf52840_xxaa.out: \
LINKER_SCRIPT := nimble_FreeRTOS_gcc_nrf52.ld
# Source files common to all targets
SRC_FILES += \
$(SDK_ROOT)/modules/nrfx/mdk/gcc_startup_nrf52840.S \
$(SDK_ROOT)/components/boards/boards.c \
$(SDK_ROOT)/external/freertos/source/croutine.c \
$(SDK_ROOT)/external/freertos/source/event_groups.c \
$(SDK_ROOT)/external/freertos/source/portable/MemMang/heap_1.c \
$(SDK_ROOT)/external/freertos/source/list.c \
$(SDK_ROOT)/external/freertos/portable/GCC/nrf52/port.c \
$(SDK_ROOT)/external/freertos/portable/CMSIS/nrf52/port_cmsis.c \
$(SDK_ROOT)/external/freertos/portable/CMSIS/nrf52/port_cmsis_systick.c \
$(SDK_ROOT)/external/freertos/source/queue.c \
$(SDK_ROOT)/external/freertos/source/stream_buffer.c \
$(SDK_ROOT)/external/freertos/source/tasks.c \
$(SDK_ROOT)/external/freertos/source/timers.c \
$(SDK_ROOT)/components/libraries/button/app_button.c \
$(SDK_ROOT)/components/libraries/util/app_error.c \
$(SDK_ROOT)/components/libraries/util/app_error_handler_gcc.c \
$(SDK_ROOT)/components/libraries/util/app_error_weak.c \
$(SDK_ROOT)/components/libraries/timer/app_timer_freertos.c \
$(SDK_ROOT)/components/libraries/util/app_util_platform.c \
$(SDK_ROOT)/components/libraries/util/nrf_assert.c \
$(SDK_ROOT)/components/libraries/strerror/nrf_strerror.c \
$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_clock.c \
$(SDK_ROOT)/components/drivers_nrf/nrf_soc_nosd/nrf_nvic.c \
$(SDK_ROOT)/components/drivers_nrf/nrf_soc_nosd/nrf_soc.c \
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_clock.c \
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_gpiote.c \
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_power_clock.c \
$(SDK_ROOT)/components/libraries/bsp/bsp.c \
$(PROJ_DIR)/main.c \
$(PROJ_DIR)/ble.c \
$(SDK_ROOT)/modules/nrfx/mdk/system_nrf52840.c \
# Include folders common to all targets
INC_FOLDERS += \
$(PROJ_DIR)/config \
$(SDK_ROOT)/components \
$(SDK_ROOT)/modules/nrfx/mdk \
$(SDK_ROOT)/components/libraries/experimental_log \
$(PROJ_DIR) \
$(SDK_ROOT)/components/libraries/timer \
$(SDK_ROOT)/components/libraries/strerror \
$(SDK_ROOT)/components/toolchain/cmsis/include \
$(SDK_ROOT)/external/freertos/source/include \
$(SDK_ROOT)/external/freertos/config \
$(SDK_ROOT)/components/libraries/util \
../config \
$(SDK_ROOT)/components/libraries/balloc \
$(SDK_ROOT)/modules/nrfx/hal \
$(SDK_ROOT)/components/libraries/bsp \
$(SDK_ROOT)/components/libraries/button \
$(SDK_ROOT)/modules/nrfx \
$(SDK_ROOT)/components/libraries/experimental_section_vars \
$(SDK_ROOT)/integration/nrfx/legacy \
$(SDK_ROOT)/external/freertos/portable/CMSIS/nrf52 \
$(SDK_ROOT)/components/libraries/experimental_log/src \
$(SDK_ROOT)/integration/nrfx \
$(SDK_ROOT)/components/drivers_nrf/nrf_soc_nosd \
$(SDK_ROOT)/components/boards \
$(SDK_ROOT)/components/libraries/experimental_memobj \
$(SDK_ROOT)/external/freertos/portable/GCC/nrf52 \
$(SDK_ROOT)/modules/nrfx/drivers/include \
# Libraries common to all targets
LIB_FILES += \
# Optimization flags
OPT = -Og -g3
# Uncomment the line below to enable link time optimization
#OPT += -flto
# C flags common to all targets
CFLAGS += $(OPT)
CFLAGS += -DBOARD_PCA10056
CFLAGS += -DCONFIG_GPIO_AS_PINRESET
CFLAGS += -DFLOAT_ABI_HARD
CFLAGS += -DFREERTOS
CFLAGS += -DNRF52840_XXAA
CFLAGS += -mcpu=cortex-m4
CFLAGS += -mthumb -mabi=aapcs
CFLAGS += -Wall -Werror
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
# keep every function in a separate section, this allows linker to discard unused ones
CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
CFLAGS += -fno-builtin -fshort-enums
# C++ flags common to all targets
CXXFLAGS += $(OPT)
# Assembler flags common to all targets
ASMFLAGS += -g3
ASMFLAGS += -mcpu=cortex-m4
ASMFLAGS += -mthumb -mabi=aapcs
ASMFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
ASMFLAGS += -DBOARD_PCA10056
ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET
ASMFLAGS += -DFLOAT_ABI_HARD
ASMFLAGS += -DFREERTOS
ASMFLAGS += -DNRF52840_XXAA
# Linker flags
LDFLAGS += $(OPT)
LDFLAGS += -mthumb -mabi=aapcs -L$(SDK_ROOT)/modules/nrfx/mdk -T$(LINKER_SCRIPT)
LDFLAGS += -mcpu=cortex-m4
LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
# let linker dump unused sections
LDFLAGS += -Wl,--gc-sections
# use newlib in nano version
LDFLAGS += --specs=nano.specs
nrf52840_xxaa: CFLAGS += -D__HEAP_SIZE=8192
nrf52840_xxaa: CFLAGS += -D__STACK_SIZE=8192
nrf52840_xxaa: ASMFLAGS += -D__HEAP_SIZE=8192
nrf52840_xxaa: ASMFLAGS += -D__STACK_SIZE=8192
# Add standard libraries at the very end of the linker input, after all objects
# that may need symbols provided by these libraries.
LIB_FILES += -lc -lnosys -lm
# Configure NimBLE variables
NIMBLE_ROOT := $(PROJ_DIR)/../../..
NIMBLE_CFG_CONTROLLER := 1
NIMBLE_CFG_TINYCRYPT := 1
include $(NIMBLE_ROOT)/porting/nimble/Makefile.defs
# Add NimBLE CFLAGS
CFLAGS += $(NIMBLE_CFLAGS)
# Add NPL for FreeRTOS, UART HCI transport for nRF5 SDK and all NimBLE sources
SRC_FILES += \
$(NIMBLE_ROOT)/porting/npl/freertos/src/npl_os_freertos.c \
$(NIMBLE_SRC) \
# Add NPL for FreeRTOS and all NimBLE directories to include paths
INC_FOLDERS += \
$(PROJ_DIR)/include \
$(NIMBLE_ROOT)/porting/npl/freertos/include \
$(NIMBLE_INCLUDE) \
.PHONY: default help
# Default target - first one defined
default: nrf52840_xxaa
# Print all targets that can be built
help:
@echo following targets are available:
@echo nrf52840_xxaa
@echo sdk_config - starting external tool for editing sdk_config.h
@echo flash - flashing binary
TEMPLATE_PATH := $(SDK_ROOT)/components/toolchain/gcc
include $(TEMPLATE_PATH)/Makefile.common
$(foreach target, $(TARGETS), $(call define_target, $(target)))
.PHONY: flash erase
# Flash the program
flash: $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex
@echo Flashing: $<
nrfjprog -f nrf52 --program $< --sectorerase
nrfjprog -f nrf52 --reset
erase:
nrfjprog -f nrf52 --eraseall
SDK_CONFIG_FILE := ../config/sdk_config.h
CMSIS_CONFIG_TOOL := $(SDK_ROOT)/external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar
sdk_config:
java -jar $(CMSIS_CONFIG_TOOL) $(SDK_CONFIG_FILE)
@@ -1,51 +0,0 @@
/* Linker script to configure memory regions. */
SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)
MEMORY
{
FLASH (rx) : ORIGIN = 0x0, LENGTH = 0x100000
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x40000
}
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
} INSERT AFTER .data;
SECTIONS
{
.mem_section_dummy_rom :
{
}
.log_const_data :
{
PROVIDE(__start_log_const_data = .);
KEEP(*(SORT(.log_const_data*)))
PROVIDE(__stop_log_const_data = .);
} > FLASH
.nrf_balloc :
{
PROVIDE(__start_nrf_balloc = .);
KEEP(*(.nrf_balloc))
PROVIDE(__stop_nrf_balloc = .);
} > FLASH
} INSERT AFTER .text
INCLUDE "nrf_common.ld"
File diff suppressed because it is too large Load Diff