fix version info, add hv firmware to f4

This commit is contained in:
Rene Hopf
2018-03-20 23:39:27 +01:00
parent f63b0d676e
commit a13fce3f5a
10 changed files with 103 additions and 50 deletions

View File

@@ -160,7 +160,7 @@ LDSCRIPT = stm32_flash.ld
#============================================================================
OBJECTS += $(addprefix $(OBJDIR)/,$(addsuffix .o,$(basename $(SOURCES))))
# OBJECTS += hv_firmware.o
OBJECTS += hv_firmware.o
CPPFLAGS += $(addprefix -I,$(INCDIRS))
#---------------- Preprocessor Options ----------------
@@ -242,13 +242,13 @@ LDFLAGS += $(CPU)
# Default target
#
all: gccversion boot build showsize
all: gccversion tbl boot build showsize
build: tbl elf hex bin lss sym
elf: $(TARGET).elf
hex: $(TARGET).hex
bin: $(TARGET).bin
bin: tbl $(TARGET).bin
lss: $(TARGET).lss
sym: $(TARGET).sym
@@ -297,6 +297,9 @@ f3_boot:
f3_boot_btburn:
$(MAKE) -f f3dfu/Makefile btburn
hv_firmware.o:
$(MAKE) -f stm32f303/Makefile hv_firmware.o
deploy: boot f3_boot f3 build
binall:
@@ -339,7 +342,7 @@ flash: $(TARGET).bin
#
clean:
@echo Cleaning project:
# rm -rf hv_firmware.o
rm -rf hv_firmware.o
rm -rf f3.bin f4.bin
rm -rf $(OBJDIR)
rm -rf inc/commandslist.h

View File

@@ -29,7 +29,7 @@
#define APP_END 0x08100000
#define APP_RANGE_VALID(a, s) (!(((a) | (s)) & 3) && (a) >= APP_START && ((a) + (s)) <= APP_END)
#define VERSION_INFO_OFFSET 0x188
static volatile const struct version_info *app_info = (void *)(APP_START + VERSION_INFO_OFFSET);
const version_info_t *app_info = (void *)(APP_START + VERSION_INFO_OFFSET);
static int app_ok(void) {
if(!APP_RANGE_VALID(APP_START, app_info->image_size)) {

View File

@@ -1,6 +1,6 @@
#include "version.h"
volatile const struct version_info version_info = {
volatile const version_info_t version_info __attribute__ ((section (".version_info"))) = {
.product_name = "STMBL-Bootloader",
.major = 0,
.minor = 9,

View File

@@ -909,43 +909,6 @@ void fault(char *ptr) {
COMMAND("fault", fault, "trigger fault");
void about(char *ptr) {
printf("######## software info ########\n");
printf(
"%s v%i.%i.%i %s\n",
version_info.product_name,
version_info.major,
version_info.minor,
version_info.patch,
version_info.git_version);
printf("Branch %s\n", version_info.git_branch);
printf("Compiled %s %s ", version_info.build_date, version_info.build_time);
printf("by %s on %s\n", version_info.build_user, version_info.build_host);
printf("GCC %s\n", __VERSION__);
printf("newlib %s\n", _NEWLIB_VERSION);
// printf("CMSIS %i.%i\n",__CM4_CMSIS_VERSION_MAIN,__CM4_CMSIS_VERSION_SUB);
// printf("StdPeriph %i.%i.%i\n",__STM32F4XX_STDPERIPH_VERSION_MAIN,__STM32F4XX_STDPERIPH_VERSION_SUB1,__STM32F4XX_STDPERIPH_VERSION_SUB2);
// printf("CPU ID %lx %lx %lx\n",U_ID[0], U_ID[1], U_ID[2]);
printf("size: %lu crc:%lx\n", version_info.image_size, version_info.image_crc);
// printf("######## Bootloader info ########\n");
// printf(
// "%s v%i.%i.%i %s\n",
// bt_version_info->product_name,
// bt_version_info->major,
// bt_version_info->minor,
// bt_version_info->patch,
// bt_version_info->git_version
// );
// printf("Branch %s\n",bt_version_info->git_branch);
// printf("Compiled %s %s ",bt_version_info->build_date, bt_version_info->build_time);
// printf("by %s on %s\n",bt_version_info->build_user, bt_version_info->build_host);
//
// printf("start:%p ,size:%p ,end%p \n",&_binary_obj_hv_hv_bin_start,&_binary_obj_hv_hv_bin_size,&_binary_obj_hv_hv_bin_end);
}
COMMAND("about", about, "show system infos");
void hal_set_debug_level(uint32_t debug_level){
hal.debug_level = debug_level;
}

View File

@@ -2,9 +2,8 @@
#include <stdint.h>
struct version_info { //TODO: typedef
typedef struct{
// set at link-time by add-version-info.py
//
uint32_t image_crc;
uint32_t image_size;
@@ -21,6 +20,6 @@ struct version_info { //TODO: typedef
int major;
int minor;
int patch;
};
} version_info_t;
extern volatile const struct version_info version_info __attribute__((section(".version_info")));
extern volatile const version_info_t version_info;

View File

@@ -105,6 +105,64 @@ void nv_reset(char *ptr) {
}
COMMAND("reset", nv_reset, "reset STMBL");
void about(char *ptr) {
printf("######## software info ########\n");
printf(
"%s v%i.%i.%i %s\n",
version_info.product_name,
version_info.major,
version_info.minor,
version_info.patch,
version_info.git_version);
printf("Branch %s\n", version_info.git_branch);
printf("Compiled %s %s ", version_info.build_date, version_info.build_time);
printf("by %s on %s\n", version_info.build_user, version_info.build_host);
printf("GCC %s\n", __VERSION__);
printf("newlib %s\n", _NEWLIB_VERSION);
#ifdef __CM4_CMSIS_VERSION
printf("CMSIS %i.%i\n",__CM4_CMSIS_VERSION_MAIN,__CM4_CMSIS_VERSION_SUB);
#endif
#ifdef __STM32F4XX_STDPERIPH_VERSION
printf("StdPeriph %i.%i.%i\n",__STM32F4XX_STDPERIPH_VERSION_MAIN,__STM32F4XX_STDPERIPH_VERSION_SUB1,__STM32F4XX_STDPERIPH_VERSION_SUB2);
#endif
#ifdef __STM32F3xx_HAL_VERSION
printf("HAL lib... TODO: print version\n");
#endif
// printf("CPU ID %lx %lx %lx\n",U_ID[0], U_ID[1], U_ID[2]);
printf("size: %lu crc:%lx\n", version_info.image_size, version_info.image_crc);
volatile const version_info_t* bt_version_info = (void*)0x08000188;
printf("######## Bootloader info ########\n");
printf(
"%s v%i.%i.%i %s\n",
bt_version_info->product_name,
bt_version_info->major,
bt_version_info->minor,
bt_version_info->patch,
bt_version_info->git_version
);
extern uint8_t _binary_obj_hvf3_hvf3_bin_start;
extern uint8_t _binary_obj_hvf3_hvf3_bin_size;
extern uint8_t _binary_obj_hvf3_hvf3_bin_end;
volatile const version_info_t* hv_version_info = (void*)(&_binary_obj_hvf3_hvf3_bin_start + 0x188);
printf("######## HV info ########\n");
printf(
"%s v%i.%i.%i %s\n",
hv_version_info->product_name,
hv_version_info->major,
hv_version_info->minor,
hv_version_info->patch,
hv_version_info->git_version
);
// printf("Branch %s\n",bt_version_info->git_branch);
// printf("Compiled %s %s ",bt_version_info->build_date, bt_version_info->build_time);
// printf("by %s on %s\n",bt_version_info->build_user, bt_version_info->build_host);
//
printf("hv start:%p ,size:%p ,end%p \n",&_binary_obj_hvf3_hvf3_bin_start, &_binary_obj_hvf3_hvf3_bin_size, &_binary_obj_hvf3_hvf3_bin_end);
}
COMMAND("about", about, "show system infos");
int main(void) {
// Relocate interrupt vectors
extern void *g_pfnVectors;

View File

@@ -1,6 +1,6 @@
#include "version.h"
volatile const struct version_info version_info = {
volatile const version_info_t version_info __attribute__ ((section (".version_info"))) = {
.product_name = "STMBL",
.major = 0,
.minor = 9,

View File

@@ -182,7 +182,7 @@ build: tbl elf hex bin lss sym
elf: $(TARGET).elf
hex: $(TARGET).hex
bin: $(TARGET).bin
bin: tbl $(TARGET).bin
lss: $(TARGET).lss
sym: $(TARGET).sym
@@ -202,6 +202,9 @@ tbl:
gccversion:
@$(CC) --version
hv_firmware.o: bin
$(OBJCOPY) --rename-section .data=.hv_firmware -I binary obj_hvf3/hvf3.bin -B arm -O elf32-littlearm hv_firmware.o
# Show the final program size
#
showsize: build

View File

@@ -82,6 +82,33 @@ void TIM8_UP_IRQHandler() {
GPIOA->BSRR |= GPIO_PIN_9 << 16;
}
void about(char *ptr) {
printf("######## software info ########\n");
printf(
"%s v%i.%i.%i %s\n",
version_info.product_name,
version_info.major,
version_info.minor,
version_info.patch,
version_info.git_version);
printf("Branch %s\n", version_info.git_branch);
printf("Compiled %s %s ", version_info.build_date, version_info.build_time);
printf("by %s on %s\n", version_info.build_user, version_info.build_host);
printf("GCC %s\n", __VERSION__);
printf("newlib %s\n", _NEWLIB_VERSION);
#ifdef __CM4_CMSIS_VERSION
printf("CMSIS %i.%i\n",__CM4_CMSIS_VERSION_MAIN,__CM4_CMSIS_VERSION_SUB);
#endif
#ifdef __STM32F4XX_STDPERIPH_VERSION
printf("StdPeriph %i.%i.%i\n",__STM32F4XX_STDPERIPH_VERSION_MAIN,__STM32F4XX_STDPERIPH_VERSION_SUB1,__STM32F4XX_STDPERIPH_VERSION_SUB2);
#endif
#ifdef __STM32F3xx_HAL_VERSION
printf("HAL lib... TODO: print version\n");
#endif
}
COMMAND("about", about, "show system infos");
void bootloader(char *ptr) {
#ifdef USB_DISCONNECT_PIN
HAL_GPIO_WritePin(USB_DISCONNECT_PORT, USB_DISCONNECT_PIN, GPIO_PIN_SET);

View File

@@ -1,6 +1,6 @@
#include "version.h"
volatile const struct version_info version_info = {
volatile const version_info_t version_info __attribute__ ((section (".version_info"))) = {
.product_name = "STMBL-hv-f303",
.major = 0,
.minor = 9,