Skip to content

Commit

Permalink
RAM optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
dakhnod committed Jan 22, 2023
1 parent 0e022b8 commit 5991d16
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 6 deletions.
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ ADB_DIRECTORY := /sdcard/dfu

BOARD := BEACON_BIG

MAX_PIN_COUNT := 16
MAX_PIN_COUNT := 32
MAX_INPUT_PIN_COUNT := 8

FIRMWARE_VERSION := \"0.5.1\"

$(OUTPUT_DIRECTORY)/$(TARGETS).out: \
LINKER_SCRIPT := src/linker/nrf51822.ld
LINKER_SCRIPT := src/linker/nrf51822_qfaa.ld

# Source files common to all targets
SRC_FILES += \
Expand Down Expand Up @@ -222,7 +224,7 @@ CFLAGS += -DNRF51822
CFLAGS += -DNRF_SD_BLE_API_VERSION=2
CFLAGS += -mcpu=cortex-m0
CFLAGS += -mthumb -mabi=aapcs
CFLAGS += -Wall -Werror -O0 -g3
CFLAGS += -Wall -Werror -O3 -g3
CFLAGS += -mfloat-abi=soft
# keep every function in separate section, this allows linker to discard unused ones
CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
Expand All @@ -231,10 +233,11 @@ CFLAGS += -DNRF_DFU_SETTINGS_VERSION=1
CFLAGS += -DUSE_DFU
CFLAGS += -DUSE_SPI
CFLAGS += -DUSE_UART
ifeq ($(BOARD), BLE400)
ifeq ($(BOARD), WT51822-S4AT)
CFLAGS += -DDEBUG
endif
CFLAGS += -DBUTTON_PIN=BUTTON_0
CFLAGS += -DFIRMWARE_VERSION=$(FIRMWARE_VERSION)

# C++ flags common to all targets
CXXFLAGS += \
Expand Down
2 changes: 1 addition & 1 deletion src/ble/sensor_ble.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ void ble_handle_connection_parameters_configuration_update(ble_configuration_con

ret_code_t dis_init(){
char *manufacturer = "https://github.com/dakhnod/nRF51-GPIO-BLE-Bridge";
char *version_fw = "0.5.1";
char *version_fw = FIRMWARE_VERSION;
ble_srv_security_mode_t sec_mode;
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&sec_mode.write_perm);
Expand Down
2 changes: 1 addition & 1 deletion src/config/sdk_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3475,7 +3475,7 @@
// <e> NRF_LOG_ENABLED - nrf_log - Logging
//==========================================================
#ifndef NRF_LOG_ENABLED
#define NRF_LOG_ENABLED 1
#define NRF_LOG_ENABLED 0
#endif
#if NRF_LOG_ENABLED
// <e> NRF_LOG_USES_COLORS - If enabled then ANSI escape code for colors is prefixed to every string
Expand Down
File renamed without changes.
36 changes: 36 additions & 0 deletions src/linker/nrf51822_qfac.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* Linker script to configure memory regions. */

SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)

MEMORY
{
/* flash length is calculated using the flash origin of the bootloader_secure */
/* last subtraction is to have some free flash for pin configuration settings */
FLASH (rx) : ORIGIN = 0x0001b000, LENGTH = 0x00035C00 - 0x0001b000 - 0x0400
RAM (rwx) : ORIGIN = 0x20002008, LENGTH = 0x1ff8 + 0x4000 /* 16kB more than qfaa */
BOOTLOADER_SETTINGS (rw) : ORIGIN = 0x0003FC00, LENGTH = 0x0400
}

SECTIONS
{
/* Ensures the bootloader settings are placed at the last flash page. */
.bootloaderSettings(NOLOAD) :
{

} > BOOTLOADER_SETTINGS
.fs_data :
{
PROVIDE(__start_fs_data = .);
KEEP(*(.fs_data))
PROVIDE(__stop_fs_data = .);
} > RAM
.pwr_mgmt_data :
{
PROVIDE(__start_pwr_mgmt_data = .);
KEEP(*(.pwr_mgmt_data))
PROVIDE(__stop_pwr_mgmt_data = .);
} > RAM
} INSERT AFTER .data;

INCLUDE "nrf5x_common.ld"

0 comments on commit 5991d16

Please sign in to comment.