cancel
Showing results for 
Search instead for 
Did you mean: 

How to save time in production with STM32F429

Linda
Associate II
Posted on May 25, 2015 at 14:22

Hi,

We are preparing production now. Because we use Unique ID to protect the products, each time we need to key the 96 digit Unique ID into the original file, then run the compile(rebuild), then flash into MCU. There is any way to skip the compile(rebuild) step. It take too long to compile for each MCU.

Thanks a lot 
15 REPLIES 15
Posted on May 25, 2015 at 14:35

Write it directly to the binary, using e.g. the srecord suite (it's nontrivial, be prepared to do some manuals reading).

Some of the ''production programmers'' and/or their software can insert serial number as an option.

Or, leave the place for the serial number empty (unprogrammed), generate the serial number as a binary/hex file, and program the target device in two steps.

JW

Posted on May 25, 2015 at 15:48

Recompiling it seems excessive, I'd just sign the binary in the programming app, and have multiple programming stations.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Linda
Associate II
Posted on May 26, 2015 at 11:31

Thanks. I am trying it now. I might need your further direction, will keep your posted.

Linda
Associate II
Posted on May 28, 2015 at 14:27

My dear,

These program seems working fine, thanks.

But my problem is, I have hard time to locate some variable, so that I can replace them. I try to put 0x77777777 in the original file, then compile it, then try to find 0x77777777 in the *.hex file. I can find some varialbe, but not all of them.these variable has to be special type? 

I had try to compare 2 *.hex also, it doesn't work eighter. I have try to use static variable, not work.

Do you have better way to loacte variable?

Posted on May 28, 2015 at 15:59

The .MAP file has human readable addresses, the .ELF/AXF files have symbol associations.

Perhaps you can put all you chip specific stuff into a structure, and have at signature in it, and make it a ''static const''

Data can span multiple .HEX records. Data in the statics area (copied to RAM) can be compressed or folded.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Linda
Associate II
Posted on May 28, 2015 at 17:01

Sorry, I couldn't understand how the signiture work, do you mean I can sign  the signure in ST-Link Utility, could you please explain more?

Thanks

Posted on May 28, 2015 at 22:10

One of your problems here is an over dependency on tools other people have written.

Here we write our own production programming software. The ST-LINK wouldn't be my route of choice, but I seem to recall ST providing a library level interface for it some while back, and people like Segger have DLL and libraries for their programmers. If your task was to simply removed the edit/compile/link steps you should be able to take a .ELF, .BIN or .HEX and modify it or sign it on a per processor basis. If you want this to be remotely efficient you're going to have to automate the process. Signing and encrypting a firmware image can get quite involved, so I'll stick here with just a small chip/board unique structure that can be filled in by a suitably coded programming station.

typedef struct _SIGNFOO {
uint32_t Signature;
uint32_t Size;
uint32_t Identifier[3];
// Other assorted stuff filled in by production programmer added here
uint32_t Checksum;
} SIGNFOO;
void CheckChipUnique(void)
{
static const SIGNFOO SignFoo = { 0xDEADBEEF, sizeof(SIGNFOO), 0x12345678, 0x9ABCDEF0, 0x87654321, 0 };
uint32_t i, sum;
uint32_t *p = (uint32_t *)&SignFoo;
sum = 0;
for(i=0; i<((SignFoo.Size / sizeof(uint32_t)) - 1); i++)
sum += *p++;
if (sum != SignFoo.Checksum)
{
puts(''Intergity Check Failed'');
return;
}
// Perform chip unique configuration and verification
}
int main(void)
{
CheckChipUnique();
while(1);
}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Linda
Associate II
Posted on May 29, 2015 at 07:31

Dear Clive1,

Right now, my task is to simply removed the edit/compile/link steps, I tooke the .HEX and try modify it , but I don't know where I should modify. I try to locate the place to modify. I am not able to locate these variable(

static const

)  in .HEX file. I had tried to put

static const

1=0x77777777, then after compile it I tried to look for 0x77777777 in .HEX file, but I could not find it. I had tried to compare two .Hex file after change the value of static const. It didn't work.

Could you please tell me some other ways.

Thanks  a lot

Posted on May 29, 2015 at 18:46

The structure in the prior thread can be found in the binary data stream. One needs to make sure it's called/referenced somewhere otherwise the linker might drop it when doing dead code elimination.

I'd load the binary data into memory, and search for the 0xEF,0xBE,0xAD,0xDE, 0x18,0x00,0x00,0x00, 0x78,0x56,..  pattern. Once found you'd modify the structure with your Chip Id and checksum the data before writing it back out as a .BIN or .HEX or whatever.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..