Add version to firmware image

This commit is contained in:
Jeremy Soller
2020-02-16 12:24:02 -07:00
parent 17cce5687f
commit 81ffcf5ae1
6 changed files with 38 additions and 8 deletions

View File

@ -19,7 +19,7 @@
#include <board/smbus.h>
#include <common/debug.h>
#include <common/macro.h>
#include <common/version.h>
void external_0(void) __interrupt(0) {}
// timer_0 is in time.c
@ -91,7 +91,7 @@ void main(void) {
gpio_set(&SMI_N, true);
gpio_set(&SWI_N, true);
INFO("Hello from System76 EC for %s!\n", xstr(__BOARD__));
INFO("System76 EC board '%s', version '%s'\n", board(), version());
for(main_cycle = 0; ; main_cycle++) {
// Handle power states

View File

@ -20,7 +20,7 @@
#include <board/smbus.h>
#include <common/debug.h>
#include <common/macro.h>
#include <common/version.h>
void external_0(void) __interrupt(0) {}
// timer_0 is in time.c
@ -93,7 +93,7 @@ void main(void) {
gpio_set(&SMI_N, true);
gpio_set(&SWI_N, true);
INFO("Hello from System76 EC for %s!\n", xstr(__BOARD__));
INFO("System76 EC board '%s', version '%s'\n", board(), version());
for(main_cycle = 0; ; main_cycle++) {
// Handle power states

View File

@ -21,7 +21,7 @@
#include <board/tcpm.h>
#include <common/debug.h>
#include <common/macro.h>
#include <common/version.h>
void external_0(void) __interrupt(0) {}
// timer_0 is in time.c
@ -95,7 +95,7 @@ void main(void) {
gpio_set(&SMI_N, true);
gpio_set(&SWI_N, true);
INFO("Hello from System76 EC for %s!\n", xstr(__BOARD__));
INFO("System76 EC board '%s', version '%s'\n", board(), version());
for(main_cycle = 0; ; main_cycle++) {
// Handle power states

View File

@ -0,0 +1,7 @@
#ifndef _COMMON_VERSION_H
#define _COMMON_VERSION_H
const char * board();
const char * version();
#endif // _COMMON_VERSION_H

17
src/common/version.c Normal file
View File

@ -0,0 +1,17 @@
#include <common/macro.h>
static const char __code BOARD[] =
"76EC_BOARD="
xstr(__BOARD__);
static const char __code VERSION[] =
"76EC_VERSION="
xstr(__VERSION__);
const char * board() {
return &BOARD[11];
}
const char * version() {
return &VERSION[13];
}