cancel
Showing results for 
Search instead for 
Did you mean: 

Saving version number of assets in ext. flash

Hi,

Does anyone have an idea how to save a version number of assets into the ext. flash?

I've tried it with text resource, where the version number (e.g. 1.0.0.6) is saved.

But in the development process I've moved Font and Text to the internal flash. On the external flash are only the images. So in this case the version number does not match the ext. flash version.

I would like to have any string or uint32_t on the external flash to show what version it has.

Regards

Dejan

6 REPLIES 6
Alexandre RENOUX
Principal

Hello,

Have you tried to put the font and text in external Flash or is there a reason why you don't do it this way ?

I'm not sure I understand fully your issue. Could you elaborate more ? Maybe provide some code ?

/Alexandre

Hi @Alexandre RENOUX​ 

Yes, I have tried to do so. But in the developement process it would be to much if the external flash has to be updated in every build, so I moved the text to the internal flash. So I need to update the ext. flash only when I change or add images.

Maybe there is a solution like with the images where you can pick the storage (int or ext) where the asset should be placed.

Do you know if it is possible to save only one text in the external flash and the rest in the internal? Maybe a config in TouchGFX or in linker script?

Regards

Dejan

Alexandre RENOUX
Principal

A simple solution would be to declare an array in the code and specify that this array should be in the external Flash

LOCATION_PRAGMA("ExtFlashSection")
KEEP extern const unsigned char application_version[] LOCATION_ATTRIBUTE("ExtFlashSection") = 
{ 
//your data
}

/Alexandre

How can I access "application_version" directly from the external flash?

For example, I have written the version "1.0.2.2" to the ext flash. Then I write to the internal flash the increased the version "1.0.2.3". So the internal flash should have the version "1.0.2.3" and the external "1.0.2.2", because I updated only the internal flash.

When I print the version of external flash I always get the"1.0.2.3".

Maybe I am accessing it wrong:

#include <touchgfx/hal/Config.hpp>
 
LOCATION_PRAGMA("ExtFlashSection")
KEEP extern const unsigned char extflash_version[] LOCATION_ATTRIBUTE("ExtFlashSection") = FW_REV;
#include <gui/startscreen_screen/StartScreenView.hpp>
#include <texts/TextKeysAndLanguages.hpp>
 
extern const unsigned char extflash_version[];
 
StartScreenView::StartScreenView()
{
 
}
 
void StartScreenView::setupScreen()
{
    StartScreenViewBase::setupScreen();
    mirror.setPosition(0, 0, HAL::DISPLAY_WIDTH, HAL::DISPLAY_HEIGHT);
	add(mirror);
 
	Unicode::strncpy(textVersionBuffer, (char *) FW_REV, TEXTVERSION_SIZE);
	textVersion.invalidate();
	Unicode::strncpy(textVersionExtBuffer, (char *) extflash_version, TEXTVERSIONEXT_SIZE);
	textVersionExt.invalidate();
}
 
void StartScreenView::tearDownScreen()
{
    StartScreenViewBase::tearDownScreen();
}

Regards

Dejan

Alexandre RENOUX
Principal

Does it really compile ?

You declare twice the same variable. Have you tried declaring in your StartScreenView.cpp, an extern const unsigned char intflash_version[] instead and see the value of extflash_version ?

/Alexandre

Somehow I got it working.

#include <touchgfx/hal/Config.hpp>
 
LOCATION_PRAGMA("ExtFlashSection")
KEEP extern const char extflash_version_string[SGN_VERS_SIZE] LOCATION_ATTRIBUTE("ExtFlashSection") = {FW_REV};

Maybe it's because I have declared the size of the const char array and initilized it with curly braces --> {FW_REV}

@Alexandre RENOUX​ thank you for the support.

Regards

Dejan