Skip to content

Makefile: reject unsupported TARGET values - #157

Open
PhysicistJohn wants to merge 1 commit into
erikkaashoek:mainfrom
PhysicistJohn:build/validate-target
Open

Makefile: reject unsupported TARGET values#157
PhysicistJohn wants to merge 1 commit into
erikkaashoek:mainfrom
PhysicistJohn:build/validate-target

Conversation

@PhysicistJohn

Copy link
Copy Markdown

Problem

Firmware target selection currently depends on where TARGET originates.

A command-line typo such as make TARGET=TYPO is not overwritten by the
Makefile. It falls through the later conditionals and silently produces an
F072 firmware image.

Conversely, an environment-supplied TARGET=F072 is overwritten with F303.

Both cases can produce apparently valid firmware for the wrong MCU.

Change

Default an undefined TARGET to F072 and accept exactly the two supported
values, F072 and F303. Any other value now produces a make-time error.

Verification

Tested with GNU Make 3.81 and Arm GNU Toolchain 11.3.Rel1:

  • default, explicit F072, and explicit F303 builds pass
  • command-line and environment target values select the same MCU
  • invalid targets exit with status 2 before producing an F072 artifact
  • with a fixed version and build epoch, both valid firmware binaries are
    byte-for-byte identical to unmodified upstream

No firmware source or compiler flags are changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant