Zerocat Chipflasher  v0.4.10-182-333b622f
Flash free firmware to BIOS chips, kick the Management Engine.
Makefile File Reference

Upload kick, the chipflasher’s firmware. More...

Detailed Description

Code

##>! @file
##>!
##>! @brief Upload `kick`, the chipflasher’s firmware.
##>!
##>! # Copyright
##>!
##>! Zerocat Chipflasher --- Flash free firmware to BIOS chips,
##>!                         kick the Management Engine.
##>!
##>! Copyright (C) 2017, 2018, 2020, 2021 Kai Mertens <kmx@posteo.net>
##>!
##>! The Zerocat Chipflasher 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.
##>!
##>! The Zerocat Chipflasher 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 should have received a copy of the GNU General Public License
##>! along with this program.  If not, see <http://www.gnu.org/licenses/>.
##>!
##>! This file is part of the Zerocat Chipflasher.
##>!
##>! # “In file” Documentation
##>!
##>! @note
##>! When building the documentation, doxygen is forced to parse this file with the
##>! C-parser as no appropriate parser is available. Comment tags `##>` will be translated
##>! into C-style comment tags `//` in order to satisfy the parser, see tag INPUT_FILTER
##>! in the Doxyfile. Please disable the parsing of non-C code with directives \@cond and
##>! \@endcond.
##>!
##>! ## Usage
##>!
##>!     $ make help
##>!
##>! @cond
#

# Shell
SHELL                         := /bin/sh

# White Space
EMPTY                         :=
SPACE                         := $(EMPTY) $(EMPTY)
COMMA                         := ,
M5                            := xxxxx

# Suffixes
.SUFFIXES :

# Root Paths
ROOT_FIRMWARE_START           := $(EMPTY)
ROOT_FIRMWARE_SRC             := ../src/

# Utilities
ECHO                          := $(shell command -v echo)
ECHOFLAGS                     := -e
$(if $(strip $(ECHO)),,       $(error Cannot find echo utility))

SLEEP                         := $(shell command -v sleep)
SLEEPFLAGS                    :=
$(if $(strip $(SLEEP)),,      $(error Cannot find sleep utility))

CAT                           := $(shell command -v cat)
CATFLAGS                      :=
$(if $(strip $(CAT)),,        $(error Cannot find cat utility))

SED                           := $(shell command -v sed)
SEDFLAGS                      := -r
$(if $(strip $(SED)),,        $(error Cannot find sed utility))

PROPLOAD                      := $(shell command -v propeller-load)
PROPLOADFLAGS                 :=
$(if $(strip $(PROPLOAD)),,   $(error Cannot find propeller-load utility))

# Start Options (propeller-load)
KICK_LMM_ELF                  := $(ROOT_FIRMWARE_SRC)kick.lmm.elf
BOARD_CONFIG                  := $(ROOT_FIRMWARE_START)board.cfg
TTY_PORT                      := $(ROOT_FIRMWARE_START)tty_port_pointer

# Built-in Special Targets
#~ .SECONDARY :                  # Uncomment for debugging
.PHONY: all terminal loadram loadrom help hello

# Targets
#  all: same as terminal
all : hello terminal

#  load kick into RAM, run and start a propeller-terminal
terminal : $(TTY_PORT) $(BOARD_CONFIG) $(KICK_LMM_ELF)
	@$(ECHO) $(ECHOFLAGS) \
		"\n$(M5) Process target “$@” $(M5)$(M5)";
	$(PROPLOAD) $(PROPLOADFLAGS) \
		-p $(TTY_PORT) \
		-b $(basename $(BOARD_CONFIG)):terminal \
		$(KICK_LMM_ELF) \
		-r \
		-t \
		-q;

#  load kick into RAM and run
loadram : $(TTY_PORT) $(BOARD_CONFIG) $(KICK_LMM_ELF)
	@$(ECHO) $(ECHOFLAGS) \
		"\n$(M5) Process target “$@” $(M5)$(M5)";
	$(PROPLOAD) $(PROPLOADFLAGS) \
		-p $(TTY_PORT) \
		-b $(basename $(BOARD_CONFIG)):rstdisable \
		$(KICK_LMM_ELF) \
		-r && \
	$(SLEEP) $(SLEEPFLAGS) \
		1.5s;

#  load kick into EEPROM, don't run
loadrom : $(TTY_PORT) $(BOARD_CONFIG) $(KICK_LMM_ELF)
	@$(ECHO) $(ECHOFLAGS) \
		"\n$(M5) Process target “$@” $(M5)$(M5)";
	$(PROPLOAD) $(PROPLOADFLAGS) \
		-p $(TTY_PORT) \
		-b $(basename $(BOARD_CONFIG)) \
		$(KICK_LMM_ELF) \
		-e;

#  display help information
help : hello
	@$(ECHO) $(ECHOFLAGS) \
		"\n$(M5) Process target “$@” $(M5)$(M5)";
	@$(ECHO) $(ECHOFLAGS) \
		"\nList Of Targets"\
		"\n---------------"\
		"\nall\r\t\tsame as terminal"\
		"\nterminal\r\t\tload kick into RAM, run and start a propeller-terminal"\
		"\nloadram\r\t\tload kick into RAM and run"\
		"\nloadrom\r\t\tload kick into EEPROM, don't run"\
		"\nhelp\r\t\tdisplay this help information"\
		"\nhello\r\t\tgreeter, provided with all, clean and help"\
		"\n";

#  Say hello.
#   provided with all, clean and help
hello :
	@$(ECHO) $(ECHOFLAGS) \
		"\n$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)"\
		"\n$(M5) Zerocat Chipflasher – Firmware Upload"\
		"\n$(M5) This Makefile loads Firmware Files into RAM or EEPROM."\
		"\n$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)$(M5)";

# FIXME Those steps missing:
#  propeller-load -s cmm/libfdserial.elf
#  propeller-elf-objdump -h cmm/libfdserial.elf

##>! @endcond

Copyright

Zerocat Chipflasher — Flash free firmware to BIOS chips, kick the Management Engine.

Copyright (C) 2017, 2018, 2020, 2021 Kai Mertens kmx@p.nosp@m.oste.nosp@m.o.net

The Zerocat Chipflasher 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.

The Zerocat Chipflasher 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 should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

This file is part of the Zerocat Chipflasher.

“In file” Documentation

Note
When building the documentation, doxygen is forced to parse this file with the C-parser as no appropriate parser is available. Comment tags ##> will be translated into C-style comment tags // in order to satisfy the parser, see tag INPUT_FILTER in the Doxyfile. Please disable the parsing of non-C code with directives @cond and @endcond.

Usage

$ make help