Skip to content

Commit

Permalink
#546 Moved some memory blocks to CCM. Freed around 40k RAM.
Browse files Browse the repository at this point in the history
  • Loading branch information
krichardsson committed May 14, 2020
1 parent be5ae38 commit 8c925aa
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/deck/core/deck_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "ow.h"
#include "crc.h"
#include "debug.h"
#include "static_mem.h"

#ifdef DEBUG
#define DECK_INFO_DBG_PRINT(fmt, ...) DEBUG_PRINT(fmt, ## __VA_ARGS__)
Expand All @@ -43,7 +44,7 @@
#endif

static int count = 0;
static DeckInfo deckInfos[DECK_MAX_COUNT];
NO_DMA_CCM_SAFE_ZERO_INIT static DeckInfo deckInfos[DECK_MAX_COUNT];

static void enumerateDecks(void);
static void checkPeriphAndGpioConflicts(void);
Expand Down
3 changes: 2 additions & 1 deletion src/deck/drivers/src/lpsTwrTag.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "physicalConstants.h"
#include "configblock.h"
#include "lpsTdma.h"
#include "static_mem.h"

#define ANTENNA_OFFSET 154.6 // In meter

Expand Down Expand Up @@ -100,7 +101,7 @@ static lpsTwrAlgoOptions_t* options = &defaultOptions;
// Outlier rejection
#define RANGING_HISTORY_LENGTH 32
#define OUTLIER_TH 4
static struct {
NO_DMA_CCM_SAFE_ZERO_INIT static struct {
float32_t history[RANGING_HISTORY_LENGTH];
size_t ptr;
} rangingStats[LOCODECK_NR_OF_TWR_ANCHORS];
Expand Down
2 changes: 1 addition & 1 deletion src/hal/src/sensors_bmi088_bmp388.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static volatile uint64_t imuIntTimestamp;

static Axis3i16 gyroRaw;
static Axis3i16 accelRaw;
static BiasObj gyroBiasRunning;
NO_DMA_CCM_SAFE_ZERO_INIT static BiasObj gyroBiasRunning;
static Axis3f gyroBias;
#if defined(SENSORS_GYRO_BIAS_CALCULATE_STDDEV) && defined (GYRO_BIAS_LIGHT_WEIGHT)
static Axis3f gyroBiasStdDev;
Expand Down
2 changes: 1 addition & 1 deletion src/hal/src/sensors_bmi088_spi_bmp388.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static volatile uint64_t imuIntTimestamp;

static Axis3i16 gyroRaw;
static Axis3i16 accelRaw;
static BiasObj gyroBiasRunning;
NO_DMA_CCM_SAFE_ZERO_INIT static BiasObj gyroBiasRunning;
static Axis3f gyroBias;
#if defined(SENSORS_GYRO_BIAS_CALCULATE_STDDEV) && defined (GYRO_BIAS_LIGHT_WEIGHT)
static Axis3f gyroBiasStdDev;
Expand Down
2 changes: 1 addition & 1 deletion src/hal/src/sensors_mpu9250_lps25h.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static volatile uint64_t imuIntTimestamp;

static Axis3i16 gyroRaw;
static Axis3i16 accelRaw;
static BiasObj gyroBiasRunning;
NO_DMA_CCM_SAFE_ZERO_INIT static BiasObj gyroBiasRunning;
static Axis3f gyroBias;
#if defined(SENSORS_GYRO_BIAS_CALCULATE_STDDEV) && defined (GYRO_BIAS_LIGHT_WEIGHT)
static Axis3f gyroBiasStdDev;
Expand Down
2 changes: 1 addition & 1 deletion src/hal/src/syslink.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static void syslinkRouteIncommingPacket(SyslinkPacket *slp);

static xSemaphoreHandle syslinkAccess;

STATIC_MEM_TASK_ALLOC(syslinkTask, SYSLINK_TASK_STACKSIZE);
STATIC_MEM_TASK_ALLOC_STACK_NO_DMA_CCM_SAFE(syslinkTask, SYSLINK_TASK_STACKSIZE);

/* Syslink task, handles communication between nrf and stm and dispatch messages
*/
Expand Down
4 changes: 2 additions & 2 deletions src/modules/src/crtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ static xQueueHandle queues[CRTP_NBR_OF_PORTS];
static volatile CrtpCallback callbacks[CRTP_NBR_OF_PORTS];
static void updateStats();

STATIC_MEM_TASK_ALLOC(crtpTxTask, CRTP_TX_TASK_STACKSIZE);
STATIC_MEM_TASK_ALLOC(crtpRxTask, CRTP_RX_TASK_STACKSIZE);
STATIC_MEM_TASK_ALLOC_STACK_NO_DMA_CCM_SAFE(crtpTxTask, CRTP_TX_TASK_STACKSIZE);
STATIC_MEM_TASK_ALLOC_STACK_NO_DMA_CCM_SAFE(crtpRxTask, CRTP_RX_TASK_STACKSIZE);

void crtpInit(void)
{
Expand Down
6 changes: 2 additions & 4 deletions src/modules/src/estimator_kalman.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@
#include "estimator_kalman.h"
#include "kalman_supervisor.h"

#include "stm32f4xx.h"

#include "FreeRTOS.h"
#include "queue.h"
#include "task.h"
Expand Down Expand Up @@ -213,7 +211,7 @@ static StaticSemaphore_t dataMutexBuffer;
* For more information, refer to the paper
*/

static kalmanCoreData_t coreData;
NO_DMA_CCM_SAFE_ZERO_INIT static kalmanCoreData_t coreData;

/**
* Internal variables. Note that static declaration results in default initialization (to 0)
Expand Down Expand Up @@ -270,7 +268,7 @@ static void kalmanTask(void* parameters);
static bool predictStateForward(uint32_t osTick, float dt);
static bool updateQueuedMeasurments(const Axis3f *gyro, const uint32_t tick);

STATIC_MEM_TASK_ALLOC(kalmanTask, 3 * configMINIMAL_STACK_SIZE);
STATIC_MEM_TASK_ALLOC_STACK_NO_DMA_CCM_SAFE(kalmanTask, 3 * configMINIMAL_STACK_SIZE);

// --------------------------------------------------

Expand Down
3 changes: 2 additions & 1 deletion src/modules/src/lighthouse/lighthouse_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "lighthouse_core.h"

#include "test_support.h"
#include "static_mem.h"


static pulseProcessorResult_t angles;
Expand All @@ -67,7 +68,7 @@ static STATS_CNT_RATE_DEFINE(bs1Rate, HALF_SECOND);
static statsCntRateLogger_t* bsRates[PULSE_PROCESSOR_N_BASE_STATIONS] = {&bs0Rate, &bs1Rate};

static uint16_t pulseWidth[PULSE_PROCESSOR_N_SENSORS];
static pulseProcessor_t ppState = {};
NO_DMA_CCM_SAFE_ZERO_INIT static pulseProcessor_t ppState = {};

pulseProcessorProcessPulse_t pulseProcessorProcessPulse = (void*)0;

Expand Down
4 changes: 2 additions & 2 deletions src/modules/src/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ struct log_block {
};

static struct log_ops logOps[LOG_MAX_OPS];
static struct log_block logBlocks[LOG_MAX_BLOCKS];
NO_DMA_CCM_SAFE_ZERO_INIT static struct log_block logBlocks[LOG_MAX_BLOCKS];
static xSemaphoreHandle logLock;
static StaticSemaphore_t logLockBuffer;

Expand Down Expand Up @@ -167,7 +167,7 @@ static int logStopBlock(int id);
static void logReset();
static acquisitionType_t acquisitionTypeFromLogType(uint8_t logType);

STATIC_MEM_TASK_ALLOC(logTask, LOG_TASK_STACKSIZE);
STATIC_MEM_TASK_ALLOC_STACK_NO_DMA_CCM_SAFE(logTask, LOG_TASK_STACKSIZE);

void logInit(void)
{
Expand Down
2 changes: 1 addition & 1 deletion src/modules/src/param.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static CRTPPacket p;

static bool isInit = false;

STATIC_MEM_TASK_ALLOC(paramTask, PARAM_TASK_STACKSIZE);
STATIC_MEM_TASK_ALLOC_STACK_NO_DMA_CCM_SAFE(paramTask, PARAM_TASK_STACKSIZE);

void paramInit(void)
{
Expand Down
3 changes: 2 additions & 1 deletion src/modules/src/tdoaEngineInstance.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
#include "tdoaEngineInstance.h"
#include "log.h"
#include "param.h"
#include "static_mem.h"

tdoaEngineState_t tdoaEngineState;
NO_DMA_CCM_SAFE_ZERO_INIT tdoaEngineState_t tdoaEngineState;

LOG_GROUP_START(tdoaEngine)
STATS_CNT_RATE_LOG_ADD(stRx, &tdoaEngineState.stats.packetsReceived)
Expand Down

0 comments on commit 8c925aa

Please sign in to comment.