Add unique ID as serial number to version output
This commit is contained in:
parent
c6dd4e735c
commit
0da3ebed6f
@ -39,6 +39,8 @@ CFILES += stm-periph/uart.c stm-periph/dma-ring-buffer.c
|
||||
|
||||
CFILES += digio.c
|
||||
|
||||
CFILES += stm-periph/unique-id.c
|
||||
|
||||
DEFINES += -DDEBUGBUILD
|
||||
#TODO
|
||||
|
||||
|
14
stm-firmware/include/stm-periph/unique-id.h
Normal file
14
stm-firmware/include/stm-periph/unique-id.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef __UNIQUE_ID_H__
|
||||
#define __UNIQUE_ID_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @brief Get the device's unique 96 bit ID programmed by ST during manufacturing
|
||||
* @param high high word of ID
|
||||
* @param mid mid word of ID
|
||||
* @param low low word of ID
|
||||
*/
|
||||
void unique_id_get(uint32_t *high, uint32_t *mid, uint32_t *low);
|
||||
|
||||
#endif /* __UNIQUE_ID_H__ */
|
@ -6,6 +6,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <helper-macros/helper-macros.h>
|
||||
#include <reflow-controller/systick.h>
|
||||
#include <stm-periph/unique-id.h>
|
||||
|
||||
#ifndef GIT_VER
|
||||
#define GIT_VER "VERSION NOT SET"
|
||||
@ -27,9 +28,15 @@ static shellmatta_retCode_t shell_cmd_ver(const shellmatta_handle_t handle,
|
||||
{
|
||||
(void)arguments;
|
||||
(void)length;
|
||||
uint32_t low_id;
|
||||
uint32_t mid_id;
|
||||
uint32_t high_id;
|
||||
|
||||
unique_id_get(&high_id, &mid_id, &low_id);
|
||||
|
||||
shellmatta_printf(handle, "Reflow Oven Controller Firmware " xstr(GIT_VER) "\r\n"
|
||||
"Compiled: " __DATE__ " at " __TIME__);
|
||||
"Compiled: " __DATE__ " at " __TIME__ "\r\n"
|
||||
"Serial: %08X-%08X-%08X", high_id, mid_id, low_id);
|
||||
|
||||
return SHELLMATTA_OK;
|
||||
}
|
||||
|
15
stm-firmware/stm-periph/unique-id.c
Normal file
15
stm-firmware/stm-periph/unique-id.c
Normal file
@ -0,0 +1,15 @@
|
||||
#include <stm-periph/unique-id.h>
|
||||
|
||||
#define LOW_WORD_ADDR (0x1FFF7A10UL)
|
||||
#define MID_WORD_ADDR (LOW_WORD_ADDR+4U)
|
||||
#define HIGH_WORD_ADDR (LOW_WORD_ADDR+8U)
|
||||
|
||||
void unique_id_get(uint32_t *high, uint32_t *mid, uint32_t *low)
|
||||
{
|
||||
if (!high || !mid || !low)
|
||||
return;
|
||||
|
||||
*low = *((uint32_t *)LOW_WORD_ADDR);
|
||||
*mid = *((uint32_t *)MID_WORD_ADDR);
|
||||
*high = *((uint32_t *)HIGH_WORD_ADDR);
|
||||
}
|
Loading…
Reference in New Issue
Block a user