[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Paparazzi-devel] saving a srtucture in flash and in real time?

From: Chris
Subject: Re: [Paparazzi-devel] saving a srtucture in flash and in real time?
Date: Thu, 20 May 2021 09:18:53 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Thank you very much Gautier, that was very helpful.

As i said i am trying to write the code needed to add a si4432 module which will serve as both rc receiver and telemetry modem.

When i finish i will ask you again how to divert the telemetry serial to a software buffer for direct transmission.

The PPM input of course will not be needed since the rc channels then will come in a digital form directly from the si4432 module.


On 19/5/21 11:29 μ.μ., Gautier Hattenberger wrote:

Hello Chris,

It should be possible to read and write from flash. This is done by the "persistent settings" (not sure this is used a lot by the way).

You can check the files

You will also probably need to adapt the ld script to leave space for read/write, see arch/stm32/lisa-mx.ld


Le 14/05/2021 à 18:28, Chris a écrit :


I am trying to transfer the openlrsng firmware to the autopilot board and i have a small problem.

Since there is no eeprom in the stm32f405 is there any way to save a structure in the end of the flash memory in real time ie when running the airborne code so i can store the binding data?

So far i found some code like this:

DataLogTypeDef my_data;


int i;
uint8_t *data_p = &my_data;
flash_address = //put first flash address here

for ( i = 0; i < sizeof(DataLogTypeDef); i++, data_p++, flash_address++ )
    HAL_FLASH_Program(type_byte, flash_address, *data_p);


FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 896K /* origin size was 1024k, subtracted size of DATA */
DATA (rx)       : ORIGIN = 0x080E0000, LENGTH = 128K

.user_data (NOLOAD):
  . = ALIGN(4);
  _user_data_start = .; /* create a global symbol at user_data start */
  . = ALIGN(4);
  _user_data_end = .;  /* create a global symbol at user_data end */

then the code

uint8_t userConfig[64] __attribute__ ((section(".user_data")));
extern uint32_t _user_data_start;
extern uint32_t _user_data_end;
uint8_t ConfArray[16];
uint32_t TestArray[2];

// Copy a part from the userConfig to variable in RAM
for (i = 0; i < 16; i++)
    ConfArray[i] = userConfig[i];

// get the address of start and end of user_data in flash
// the & is importand, else you would get the value at the address _user_data_start and _user_data_end points to
TestArray[0] = (uint32_t)&_user_data_start;
TestArray[1] = (uint32_t)&_user_data_end;


Paparazzi-devel mailing list

Paparazzi-devel mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]