Additional changes to reduce core memory footprint...

- Reduce thread WA sizes for beacon and collector
- Move beacon WA to CCM
- Move AFSK decoder WA into CCM
- Fix APRS PARAM list string sizes
pull/4/head
bob 2018-07-02 21:12:24 +10:00
rodzic 058186c0e2
commit b02ac2c1e8
11 zmienionych plików z 41 dodań i 31 usunięć

Wyświetl plik

@ -150,7 +150,7 @@
* Number of general AX25/APRS processing & frame send buffers.
* Can configured as being in CCM to save system core memory use.
*/
#define NUMBER_COMMON_PKT_BUFFERS 15U
#define NUMBER_COMMON_PKT_BUFFERS 10U
#define RESERVE_BUFFERS_FOR_INTERNAL 2U
#define MAX_BUFFERS_FOR_BURST_SEND 5U
#if (MAX_BUFFERS_FOR_BURST_SEND > \

Wyświetl plik

@ -143,7 +143,7 @@
#define PKT_RX_RLS_USE_NO_FIFO FALSE
/* Number of general AX25/APRS processing & frame send buffers. */
#define NUMBER_COMMON_PKT_BUFFERS 15U
#define NUMBER_COMMON_PKT_BUFFERS 10U
#define RESERVE_BUFFERS_FOR_INTERNAL 2U
#define MAX_BUFFERS_FOR_BURST_SEND 5U
#if (MAX_BUFFERS_FOR_BURST_SEND > \

Wyświetl plik

@ -592,7 +592,8 @@ AFSKDemodDriver *pktCreateAFSKDecoder(packet_svc_t *pktHandler) {
"%s%02i", PKT_AFSK_THREAD_NAME_PREFIX, rid);
/* Create the AFSK decoder thread. */
myDriver->decoder_thd = chThdCreateFromHeap(NULL,
extern memory_heap_t *ccm_heap;
myDriver->decoder_thd = chThdCreateFromHeap(ccm_heap,
THD_WORKING_AREA_SIZE(PKT_AFSK_DECODER_WA_SIZE),
myDriver->decoder_name,
NORMALPRIO - 10,

Wyświetl plik

@ -157,7 +157,7 @@ typedef int16_t dsp_phase_t;
*/
typedef struct AFSK_data {
char decoder_name[CH_CFG_FACTORY_MAX_NAMES_LENGTH];
char decoder_name[PKT_THREAD_NAME_MAX];
/**
* @brief pointer to the packet handler.

Wyświetl plik

@ -94,12 +94,19 @@ THD_FUNCTION(pktRadioManager, arg) {
pktAddEventFlags(handler, (EVT_PKT_BUFFER_MGR_FAIL));
break;
}
#if PKT_RX_RLS_USE_NO_FIFO != TRUE
/* Create callback manager. */
if(pktCallbackManagerCreate(radio) == NULL) {
pktAddEventFlags(handler, (EVT_PKT_CBK_MGR_FAIL));
pktIncomingBufferPoolRelease(handler);
break;
}
#else
/*
* Initialize the outstanding callback count.
*/
handler->cb_count = 0;
#endif
/* Switch on modulation type. */
switch(task_object->type) {
case MOD_AFSK: {
@ -256,7 +263,9 @@ THD_FUNCTION(pktRadioManager, arg) {
/* Release packet services. */
pktIncomingBufferPoolRelease(handler);
#if PKT_RX_RLS_USE_NO_FIFO != TRUE
pktCallbackManagerRelease(handler);
#endif
/*
* Signal close completed for this session.

Wyświetl plik

@ -725,6 +725,7 @@ THD_FUNCTION(pktCallback, arg) {
pktReleaseDataBuffer(pkt_buffer);
}
#if PKT_RX_RLS_USE_NO_FIFO != TRUE
/**
* @brief Process release of completed callbacks.
* @notes Release is initiated by posting the packet buffer to the queue.
@ -736,7 +737,7 @@ THD_FUNCTION(pktCallback, arg) {
* @post Packet object is released (for this instance).
* @post If the FIFO is now unused it will be released.
*
* @param[in] arg radio unit ID.
* @param[in] arg pointer to packet service handler object.
*
* @return status (MSG_OK) on exit.
*
@ -793,6 +794,7 @@ THD_FUNCTION(pktCompletion, arg) {
}
chThdExit(MSG_OK);
}
#endif
/**
* @brief Create receive callback thread terminator.
@ -1032,6 +1034,9 @@ thread_t *pktCallbackManagerCreate(radio_unit_t radio) {
return cbh;
}
/**
*
*/
void pktIncomingBufferPoolRelease(packet_svc_t *handler) {
/* Release the dynamic objects FIFO for the incoming packet data queue. */
@ -1039,6 +1044,9 @@ void pktIncomingBufferPoolRelease(packet_svc_t *handler) {
handler->the_packet_fifo = NULL;
}
/**
*
*/
void pktCallbackManagerRelease(packet_svc_t *handler) {
/* Tell the callback terminator it should exit. */
@ -1048,8 +1056,4 @@ void pktCallbackManagerRelease(packet_svc_t *handler) {
chThdWait(handler->cb_terminator);
}
/*void pktScheduleThreadRelease(thread_t *thread) {
(void)thread;
}*/
/** @} */

Wyświetl plik

@ -123,17 +123,6 @@
#define useCCM __attribute__((section(".ram4")))
/*
* Diagnostic output definitions.
* TODO: Deprecate.
*
*/
//#define NO_SUSPEND 1
//#define RELEASE_ON_OUTPUT 2
//#define SUSPEND_HANDLING NO_SUSPEND
#ifdef PKT_IS_TEST_PROJECT
/* Define macro replacements for TRACE. */
#define TRACE_DEBUG(format, args...) dbgPrintf(DBG_DEBUG, format, ##args)
@ -142,6 +131,8 @@
#define TRACE_ERROR(format, args...) dbgPrintf(DBG_ERROR, format, ##args)
#endif
#define PKT_THREAD_NAME_MAX 12
/* Extra GPIO value used in local GPIO set/clear/toggle functions. */
#define PAL_TOGGLE 2U
#define PAL_INVALID -1

Wyświetl plik

@ -444,9 +444,6 @@ packet_t aprs_encode_position_and_telemetry(const char *callsign,
uint32_t a1 = a / 91;
uint32_t a1r = a % 91;
/* ptime_t time;
unixTimestamp2Date(&time, dataPoint->gps_time);*/
char xmit[256];
uint32_t len = chsnprintf(xmit, sizeof(xmit), "%s>%s,%s:=",
callsign,
@ -858,7 +855,8 @@ msg_t aprs_transmit_telemetry_response(aprs_identity_t *id,
* Start a run once beacon thread.
* The identity data has a ref to the bcn_app_conf_t object of the call sign.
*/
bcn_app_conf_t *aprsd = chHeapAlloc(NULL, sizeof(bcn_app_conf_t));
extern memory_heap_t *ccm_heap;
bcn_app_conf_t *aprsd = chHeapAlloc(ccm_heap, sizeof(bcn_app_conf_t));
if(aprsd == NULL)
return MSG_ERROR;
if(id->beacon == NULL)
@ -1292,7 +1290,7 @@ packet_t aprs_encode_telemetry_configuration(const char *originator,
uint8_t type) {
switch(type) {
case 0: return aprs_transmit_message(originator, path, destination,
"PARM.Vbat,Vsol,Pbat,Temperature,Airpressure,"
"PARM.Vbat,Vsol,Pbat,Temp,AirP,"
"IO1,IO2,IO3,IO4,IO5,IO6,IO7,IO8", false);
case 1: return aprs_transmit_message(originator, path, destination,
"UNIT.V,V,W,degC,Pa,Hi,Hi,Hi,Hi,Hi,Hi,Hi,Hi", false);

Wyświetl plik

@ -581,7 +581,7 @@ void init_data_collector() {
threadStarted = true;
TRACE_INFO("COLL > Startup data collector thread");
thread_t *th = chThdCreateFromHeap(NULL,
THD_WORKING_AREA_SIZE(10*1024),
THD_WORKING_AREA_SIZE(5*1024),
"COL", LOWPRIO,
collectorThread, chThdGetSelfX());
collector_thd = th;

Wyświetl plik

@ -1,6 +1,7 @@
#include "ch.h"
#include "hal.h"
#include "beacon.h"
#include "debug.h"
#include "threads.h"
#include "config.h"
@ -72,7 +73,8 @@ THD_FUNCTION(bcnThread, arg) {
TRACE_INFO("BCN > Transmit telemetry configuration");
// Encode and transmit telemetry config packet
for(uint8_t type = 0; type < APRS_NUM_TELEM_GROUPS; type++) {
uint8_t type = 0;
do {
packet_t packet = aprs_encode_telemetry_configuration(
conf->call,
conf->path,
@ -80,7 +82,7 @@ THD_FUNCTION(bcnThread, arg) {
type);
if(packet == NULL) {
TRACE_WARN("BCN > No free packet objects for"
" telemetry config transmission");
" telemetry config transmission %d", type);
} else {
if(!transmitOnRadio(packet,
conf->radio_conf.freq,
@ -89,11 +91,12 @@ THD_FUNCTION(bcnThread, arg) {
conf->radio_conf.pwr,
conf->radio_conf.mod,
conf->radio_conf.cca)) {
/* Packet is released in transmitOnRadio. */
TRACE_ERROR("BCN > Failed to transmit telemetry config");
}
}
chThdSleep(TIME_S2I(5));
}
} while(++type < APRS_NUM_TELEM_GROUPS);
last_conf_transmission += conf_sram.tel_enc_cycle;
}
@ -166,8 +169,10 @@ THD_FUNCTION(bcnThread, arg) {
*
*/
thread_t * start_beacon_thread(bcn_app_conf_t *conf, const char *name) {
thread_t *th = chThdCreateFromHeap(NULL, THD_WORKING_AREA_SIZE(10*1024),
name, LOWPRIO, bcnThread, conf);
extern memory_heap_t *ccm_heap;
thread_t *th = chThdCreateFromHeap(ccm_heap,
THD_WORKING_AREA_SIZE(PKT_APRS_BEACON_WA_SIZE),
name, LOWPRIO, bcnThread, conf);
if(!th) {
// Print startup error, do not start watchdog for this thread
TRACE_ERROR("BCN > Could not start thread (insufficient memory)");

Wyświetl plik

@ -3,6 +3,8 @@
#include "types.h"
#define PKT_APRS_BEACON_WA_SIZE (5 * 1024)
#ifdef __cplusplus
extern "C" {
#endif