Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenBLT-based USB serial bootloader #228

Merged
merged 34 commits into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
cbae026
flash layout
mck1117 Aug 26, 2023
14bd7e7
bootloader builds
mck1117 Aug 26, 2023
0beb2ba
output name
mck1117 Aug 26, 2023
a77ad48
hard fp
mck1117 Aug 26, 2023
cb37a3e
strip out dfu
mck1117 Aug 26, 2023
024380f
bootloader gets hardfault
mck1117 Aug 26, 2023
0944e5c
loader gets USB but not MSD
mck1117 Aug 26, 2023
4b090da
kinda usb?
mck1117 Aug 26, 2023
b0e81a0
USB enumerates!
mck1117 Aug 26, 2023
a5f793a
cleanup
mck1117 Aug 26, 2023
9dffa8e
shared params
mck1117 Aug 26, 2023
dd9fa92
nonfunctional openblt
mck1117 Aug 26, 2023
78e31d9
stub flash
mck1117 Aug 26, 2023
db442ba
flash.h
mck1117 Aug 26, 2023
197aba3
openblt responds over USB!
mck1117 Aug 26, 2023
296bbb5
implement flash driver
mck1117 Aug 26, 2023
f75aa47
blt conf, linker
mck1117 Aug 26, 2023
5e1ec57
boards no longer need specific openblt files
mck1117 Aug 26, 2023
1cec4d7
no ccache
mck1117 Aug 26, 2023
f5bd2e6
common_make.sh
mck1117 Aug 26, 2023
03573b2
cleanup
mck1117 Aug 26, 2023
d41c53f
delete bootloader crust
mck1117 Aug 26, 2023
f8c500f
simplifying linker logic
mck1117 Aug 26, 2023
6394894
script tweaks
mck1117 Aug 26, 2023
ce6ff8c
flash layout is handled entirely by FOME flash driver
mck1117 Aug 26, 2023
fa47e3a
simplify memcpy
mck1117 Aug 26, 2023
2ef2e83
format
mck1117 Aug 26, 2023
c138631
comment
mck1117 Aug 26, 2023
c7ea65f
dead
mck1117 Aug 27, 2023
72d7b61
makefiles cleanup
mck1117 Aug 27, 2023
0375ea3
cleanup
mck1117 Aug 27, 2023
9913d85
h7 linker script for bootloader
mck1117 Aug 27, 2023
a2de0c4
h7 bootloader build
mck1117 Aug 27, 2023
7e65819
build script
mck1117 Aug 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 3 additions & 26 deletions firmware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# see setup_linux_environment.sh but Windows is also totally fine
#

.PHONY: openblt

CHIBIOS = ChibiOS
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
RULESFILE = $(RULESPATH)/rules.mk
Expand Down Expand Up @@ -113,10 +111,6 @@ ifeq ($(USE_SMART_BUILD),)
USE_SMART_BUILD = no
endif

ifeq ($(USE_BOOTLOADER),)
USE_BOOTLOADER = no
endif

ifeq ($(USE_OPENBLT),)
USE_OPENBLT = no
endif
Expand Down Expand Up @@ -205,18 +199,9 @@ endif
include $(PROJECT_DIR)/hw_layer/mass_storage/mass_storage.mk
include $(PROJECT_DIR)/common.mk

ifeq ($(BOOTLOADERINC),)
# include default bootloader code
BOOTLOADERINC= $(PROJECT_DIR)/bootloader/
endif

ifeq ($(USE_BOOTLOADER),yes)
include $(PROJECT_DIR)/bootloader/bootloader.mk
endif

ifeq ($(USE_OPENBLT),yes)
# Reserve start of flash for OpenBLT
USE_OPT += -Wl,--defsym=BOOTLOADER=1
USE_OPT += -Wl,--defsym=HAS_BOOTLOADER=1
DDEFS += -DEFI_USE_OPENBLT=TRUE
endif

Expand All @@ -235,13 +220,12 @@ CSRC = check.c \
$(BOARDSRC) \
$(CHIBIOS_CONTRIB)/os/various/ramdisk.c \
$(CHIBIOS)/os/various/evtimer.c \
$(BOOTLOADERSRC) \
${HW_MASS_STORAGE_SRC_C} \
$(HW_LAYER_EMS) \
$(HW_LAYER_DRIVERS_CORE) \
$(HW_LAYER_DRIVERS) \
$(RUSEFI_LIB_C) \
main_hardfault.c
$(PROJECT_DIR)/hw_layer/main_hardfault.c

# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
Expand Down Expand Up @@ -279,7 +263,7 @@ TCPPSRC =
# List ASM source files here
ASMXSRC = $(ALLXASMSRC) \
$(RUSEFIASM) \
main_hardfault_asm.S
$(PROJECT_DIR)/hw_layer/main_hardfault_asm.S

#
# WARNING! order of variables is important here - for instance cypress own folders should go before default folders
Expand All @@ -289,7 +273,6 @@ INCDIR = \
$(BOARDINC) \
$(ALLINC) \
$(TESTINC) \
$(BOOTLOADERINC) \
$(CHIBIOS)/os/various \
$(RUSEFI_LIB_INC) \
$(CONFDIR) \
Expand Down Expand Up @@ -372,12 +355,6 @@ ULIBS = -lm --specs=nano.specs -Wl,--sort-section=alignment

include $(RULESFILE)

openblt:
make -f $(PROJECT_DIR)/hw_layer/openblt/openblt.mk BOARD_DIR=$(BOARD_DIR) PROJECT_BOARD=$(PROJECT_BOARD) PROJECT_CPU=$(PROJECT_CPU)

openblt_clean:
make -f $(PROJECT_DIR)/hw_layer/openblt/openblt.mk clean BOARD_DIR=$(BOARD_DIR) PROJECT_BOARD=$(PROJECT_BOARD) PROJECT_CPU=$(PROJECT_CPU)

# Enable precompiled header
include $(PROJECT_DIR)/rusefi_pch.mk
include $(PROJECT_DIR)/gitversion.mk
2 changes: 0 additions & 2 deletions firmware/bootloader/!clean_bootloader.bat

This file was deleted.

2 changes: 0 additions & 2 deletions firmware/bootloader/!compile_bootloader.bat

This file was deleted.

22 changes: 0 additions & 22 deletions firmware/bootloader/!compile_bootloader_405.bat

This file was deleted.

15 changes: 0 additions & 15 deletions firmware/bootloader/!compile_bootloader_469.bat

This file was deleted.

Binary file not shown.
14 changes: 0 additions & 14 deletions firmware/bootloader/bootloader.h

This file was deleted.

15 changes: 0 additions & 15 deletions firmware/bootloader/bootloader.mk

This file was deleted.

899 changes: 0 additions & 899 deletions firmware/bootloader/bootloader_generated.hxx

This file was deleted.

24 changes: 0 additions & 24 deletions firmware/bootloader/bootloader_storage.c

This file was deleted.

3 changes: 0 additions & 3 deletions firmware/bootloader/clean_bootloader.sh

This file was deleted.

45 changes: 45 additions & 0 deletions firmware/bootloader/openblt_chibios/flash.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/************************************************************************************//**
* \file Source/_template/flash.h
* \brief Bootloader flash driver header file.
* \ingroup Target__template_flash
* \internal
*----------------------------------------------------------------------------------------
* C O P Y R I G H T
*----------------------------------------------------------------------------------------
* Copyright (c) 2019 by Feaser http://www.feaser.com All rights reserved
*
*----------------------------------------------------------------------------------------
* L I C E N S E
*----------------------------------------------------------------------------------------
* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You have received a copy of the GNU General Public License along with OpenBLT. It
* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy.
*
* \endinternal
****************************************************************************************/
#ifndef FLASH_H
#define FLASH_H

/****************************************************************************************
* Function prototypes
****************************************************************************************/
void FlashInit(void);
void FlashReinit(void);
blt_bool FlashWrite(blt_addr addr, blt_int32u len, blt_int8u *data);
blt_bool FlashErase(blt_addr addr, blt_int32u len);
blt_bool FlashWriteChecksum(void);
blt_bool FlashVerifyChecksum(void);
blt_bool FlashDone(void);
blt_addr FlashGetUserProgBaseAddress(void);


#endif /* FLASH_H */
/*********************************** end of flash.h ************************************/
Loading