Have been trying to force LARGE array allocation in SDRAM. Due to a bug somewhere in compiler or configuration, arrays defined in l502_user_process.c with '#include l502_sdram_noinit.h' or '__attribute__((section('.sdram_noinit')))' directives (that should allocate array in SDRAM) wrongly allocates in MEM_L1_DATA_A and overfills it. Workaround: define large arrays with these directives in l502_streams.c and include them via 'extern'.

This commit is contained in:
2025-07-18 17:48:29 +03:00
parent f19d963f09
commit 1555adc25b
22 changed files with 8536 additions and 8262 deletions

View File

@ -26,6 +26,9 @@
#include "l502_user_process.h"
#include "l502_stream.h"
#include "l502_sport_rx.h"
#include "l502_user_process.h"
volatile uint32_t TX_buff[TX_BUFF_SIZE] __attribute__((section(".sdram_noinit")));
/** Размер буфера на прием данных по SPORT0 в 32-битных словах */
@ -96,7 +99,7 @@ static void f_stream_in_set_overflow(void) {
g_stream_in_state = IN_STREAM_OV_ALERT;
}
volatile uint32_t TX_buff[100000] __attribute__((section(".sdram_noinit")));

View File

@ -9,6 +9,8 @@
обработку.
*******************************************************************************/
#include "l502_stream.h"
#include "l502_hdma.h"
#include "l502_sport_tx.h"
@ -19,6 +21,7 @@
#include "l502_defs.h" // import defines of constants
#include "l502_params.h"
#include "l502_stream.h"
#include "l502_user_process.h"
@ -31,7 +34,10 @@ uint32_t streams_cnt[4] = {0,};
#define LFSM_val_X 0b01101001
//#define TX_BUFF_SIZE 1024*1024
#define TX_BUFF_SIZE 100
//#define TX_BUFF_SIZE 1000
#define LFSM_BUFF_SIZE 1000
#define LFSM_DATALEN 1024
#define dbg_sport_rx_copy_size 10
@ -39,6 +45,8 @@ uint32_t streams_cnt[4] = {0,};
//#pragma section("sdram_noinit", NO_INIT)
//#include "l502_sdram_noinit.h"
//__attribute__((section(".sdram_noinit"), far))
@ -50,10 +58,18 @@ uint32_t dbg_sport_rx_copy[dbg_sport_rx_copy_size];// = {0,};
//#include "l502_sdram_noinit.h"
//static volatile uint32_t LFSM_data[LFSM_DATALEN] = {0,};
#include "l502_sdram_noinit.h"
volatile uint32_t TX_buff[TX_BUFF_SIZE];// __attribute__((section(".sdram_noinit")));
//#include "l502_sdram_noinit.h"
//static volatile uint32_t TX_buff[TX_BUFF_SIZE];
//static volatile uint32_t TX_buff[TX_BUFF_SIZE] __attribute__((section(".sdram_noinit")));
//static volatile uint32_t TX_buff[10000] __attribute__((section(".sdram_noinit")));
//static volatile uint32_t TX_buff[10000];
//static volatile uint32_t
// = {0,};
uint32_t streams_succes_flag = 0;
/*
@ -65,11 +81,27 @@ struct dataprocess_typedef {
};
*/
//extern volatile uint32_t TX_buff[]; //size: TX_BUFF_SIZE
//extern volatile uint32_t Raw_data_buff[]; //size: RAW_DATA_BUFF_SIZE
extern volatile uint32_t Avg_buff[]; //size: AVG_BUFF_SIZE
//extern volatile uint32_t FFT_buff[]; //size: FFT_BUFF_SIZE
//int f_sport_test(void);
void l502_stream_init(void);
//struct LFSM_typedef{
// uint8_t
//};
uint8_t LFSM_started = 0;
uint8_t DY_SYN_2_value = 0;
uint8_t DY_SYN_2_value_prev = 0;
/***************************************************************************//**
@brief Обработка принятого массива данных АЦП/DIN.
@ -111,6 +143,8 @@ uint32_t usr_in_proc_data(uint32_t* data, uint32_t size) {
uint32_t radar_word_I = 0;
uint32_t TX_buff_I = 0;
uint32_t word_prev = 0;
uint32_t digital_word_prev = 0;
for (int data_I = 0; (data_I < size) && (TX_buff_I < TX_BUFF_SIZE); ++data_I){
uint32_t word = data[data_I];
@ -121,23 +155,43 @@ uint32_t usr_in_proc_data(uint32_t* data, uint32_t size) {
if (header == 0XD0){ //phy channel № 1 in common mode
//TX_buff[TX_buff_I++] = ((0b01100000 & LFSM_val_ON) << 24) & val;
TX_buff[TX_buff_I++] = 0xD0ADEFEA;
//TX_buff[TX_buff_I++] = word;
}else if (header == 0xD1){//phy channel № 2 in common mode
TX_buff[TX_buff_I++] = word;
//TX_buff[TX_buff_I++] = ((0b01100000 & LFSM_val_OFF) << 24) & val;
TX_buff[TX_buff_I++] = 0xD0ADEFEB;
//TX_buff[TX_buff_I++] = 0xD0ADEFEB;
}else{
//TX_buff[TX_buff_I++] = word;
TX_buff[TX_buff_I++] = word;
//TX_buff[TX_buff_I++] = 0xD0AAAAAA;
}
} else if ( header == 0b00000000){ //it`s digital
if (word & (0b11 << 16)){
TX_buff[TX_buff_I++] = 0b01101010 << 24;
}
} else{
//if ((word & 0x2200) == 0x2200){
TX_buff[TX_buff_I++] = word;
//TX_buff[TX_buff_I++] = 0xAD000000;
//detect rise on DI_SYN2 -- start of chirp
if (word & 0b1 << 17){
DY_SYN_2_value = 1;
}else{
DY_SYN_2_value = 0;
}
if ((DY_SYN_2_value == 1)&& (DY_SYN_2_value_prev == 0)){
TX_buff[TX_buff_I++] = 0xAD000000;
}
DY_SYN_2_value_prev = DY_SYN_2_value;
digital_word_prev = word;
} else{
// TX_buff[TX_buff_I++] = word;
}
word_prev = word;
// }else if ((header & 0b00000000) == ){
// }else if ((header & 0b00000000) == ){

View File

@ -9,13 +9,38 @@
пользователем для написания своих алгоритмов обработки данных и реализации
пользовательских команд.
******************************************************************************/
#define TX_BUFF_SIZE 100000
#define RAW_DATA_BUFF_SIZE 100000
#define AVG_BUFF_SIZE 100000
#define FFT_BUFF_SIZE 100000
enum dataprocessor_state {
OFF,
AVG,
AVG_DONE,
FFT,
FFT_DONE,
};
struct dataprocessor_dypedef{
uint8_t dataprocessor_state state;
uint8_t dataprocessor_state state_next;
uint8_t LFSM_state; // 0 -- waiting for it... ; 1 -- receiving LFSM data
uint16_t average_N_max;
uint16_t average_N;
uint32_t TX_buff_I;
uint32_t AVG_buff_I;
uint32_t FFT_buff_I;
};
#ifndef L502_USER_PROCESS_H_
#define L502_USER_PROCESS_H_
uint32_t usr_in_proc_data(uint32_t* data, uint32_t size);
uint32_t usr_out_proc_data(uint32_t* data, uint32_t size);