Merge pull request #1976 from cesanta/stm32-nodocker

Get rid of Docker, part 1
This commit is contained in:
Sergio R. Caprile 2023-01-20 14:14:07 -03:00 committed by GitHub
commit 68071d6caf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 33 deletions

View File

@ -22,9 +22,7 @@ which implements the following:
- [ARM GCC](http://mongoose.ws/tutorials/tools/#arm-gcc)
- [stlink](http://mongoose.ws/tutorials/tools/#stlink) for flashing
The Makefile defaults to using Docker for the compiler, so you don't actually need to install it if you are using a Linux/Mac workstation. If you are not, or you want to run your local ARM compiler, just append `DOCKER=` to the make commands depicted below to call the compiler directly; it must be in your executable path.
In any case, the links above will send you to tutorials on how to install each of those tools in your workstation for Linux, Mac, and Windows.
The links above will send you to tutorials on how to install each of those tools in your workstation for Linux, Mac, and Windows.
## Usage

View File

@ -1,5 +1,3 @@
ROOT ?= $(realpath $(CURDIR)/../../..)
DOCKER ?= docker run --platform linux/amd64 --rm -v $(ROOT):$(ROOT) -w $(CURDIR) mdashnet/armgcc
CFLAGS ?= -W -Wall -Wextra -Werror -Wundef -Wshadow -Wdouble-promotion \
-Wformat-truncation -fno-common -Wconversion \
-g3 -Os -ffunction-sections -fdata-sections \
@ -11,10 +9,10 @@ SOURCES = main.c startup.c syscalls.c ../../../mongoose.c
FREERTOS_VERSION ?= V10.5.0
FREERTOS_REPO ?= https://github.com/FreeRTOS/FreeRTOS-Kernel
build example: firmware.elf
build example: firmware.bin
firmware.elf: FreeRTOS-Kernel $(SOURCES)
$(DOCKER) arm-none-eabi-gcc -o $@ $(SOURCES) $(CFLAGS) \
arm-none-eabi-gcc -o $@ $(SOURCES) $(CFLAGS) \
-IFreeRTOS-Kernel/include \
-IFreeRTOS-Kernel/portable/GCC/ARM_CM4F \
-Wno-conversion \
@ -24,7 +22,7 @@ firmware.elf: FreeRTOS-Kernel $(SOURCES)
$(LDFLAGS)
firmware.bin: firmware.elf
$(DOCKER) arm-none-eabi-objcopy -O binary $< $@
arm-none-eabi-objcopy -O binary $< $@
flash: firmware.bin
st-flash --reset write firmware.bin 0x8000000

View File

@ -15,9 +15,7 @@ It implements the following:
- [ARM GCC](http://mongoose.ws/tutorials/tools/#arm-gcc)
- [stlink](http://mongoose.ws/tutorials/tools/#stlink) for flashing
The Makefile defaults to using Docker for the compiler, so you don't actually need to install it if you are using a Linux/Mac workstation. If you are not, or you want to run your local ARM compiler, just append `DOCKER=` to the make commands depicted below to call the compiler directly; it must be in your executable path.
In any case, the links above will send you to tutorials on how to install each of those tools in your workstation for Linux, Mac, and Windows.
The links above will send you to tutorials on how to install each of those tools in your workstation for Linux, Mac, and Windows.
You'll also need _git_ so the Makefile can clone the FreeRTOS-Kernel repository. We assume you have it since you got to get this repository somehow. If you don't, and don't want to install it, just get the proper [FreeRTOS-Kernel](https://github.com/FreeRTOS/FreeRTOS-Kernel) version (see the Makefile) from its repository, as you did with the Mongoose repository.

View File

@ -1,8 +1,5 @@
TARGET = firmware
ROOT ?= $(realpath $(CURDIR)/../../..)
D ?= docker
DOCKER ?= $(D) run --rm -v $(ROOT):$(ROOT) -w $(CURDIR) mdashnet/armgcc
CROSS ?= arm-none-eabi
CFLAGS ?= -W -Wall -Wextra -Werror -Wundef -Wshadow -Wdouble-promotion \
-Wformat-truncation -fno-common -Wconversion \
-g3 -Os -ffunction-sections -fdata-sections -I. -I$(ROOT) \
@ -18,21 +15,10 @@ SOURCES = boot.c main.c syscalls.c \
all build example: $(TARGET).bin
$(TARGET).bin: $(TARGET).elf
$(DOCKER) $(CROSS)-objcopy -O binary $< $@
arm-none-eabi-objcopy -O binary $< $@
$(TARGET).elf: $(SOURCES) mcu.h
$(DOCKER) $(CROSS)-gcc $(SOURCES) $(CFLAGS) $(LDFLAGS) -o $@
# Build on Windows. Download Win32 Zip from ARM GCC downloads, unzip to c:\armgcc
ARMGCC ?= c:/armgcc
windows: $(TARGET).bin
windows: CROSS = $(ARMGCC)/bin/arm-none-eabi
windows: DOCKER =
# Show top 10 stack-hungry functions
su: CFLAGS += -fstack-usage
su: $(TARGET).elf
cat *.su | sort -rnk2 | head -10
arm-none-eabi-gcc $(SOURCES) $(CFLAGS) $(LDFLAGS) -o $@
# Note: on "unknown chip id" flash error, wire BOOT0 to VDD and st-flash erase
flash: $(TARGET).bin

View File

@ -23,9 +23,7 @@ which implements the following:
- [ARM GCC](http://mongoose.ws/tutorials/tools/#arm-gcc)
- [stlink](http://mongoose.ws/tutorials/tools/#stlink) for flashing
The Makefile defaults to using Docker for the compiler, so you don't actually need to install it if you are using a Linux/Mac workstation. If you are not, or you want to run your local ARM compiler, just append `DOCKER=` to the make commands depicted below to call the compiler directly; it must be in your executable path.
In any case, the links above will send you to tutorials on how to install each of those tools in your workstation for Linux, Mac, and Windows.
The links above will send you to tutorials on how to install each of those tools in your workstation for Linux, Mac, and Windows.
## Usage

View File

@ -16,9 +16,7 @@ It implements the following:
- [ARM GCC](http://mongoose.ws/tutorials/tools/#arm-gcc)
- [stlink](http://mongoose.ws/tutorials/tools/#stlink) for flashing
The Makefile defaults to using Docker for the compiler, so you don't actually need to install it if you are using a Linux/Mac workstation. If you are not, or you want to run your local ARM compiler, just append `DOCKER=` to the make commands depicted below to call the compiler directly; it must be in your executable path.
In any case, the links above will send you to tutorials on how to install each of those tools in your workstation for Linux, Mac, and Windows.
The links above will send you to tutorials on how to install each of those tools in your workstation for Linux, Mac, and Windows.
You'll also need _git_ so the Makefile can clone the FreeRTOS-Kernel repository. We assume you have it since you got to get this repository somehow. If you don't, and don't want to install it, just get the proper [FreeRTOS-Kernel](https://github.com/FreeRTOS/FreeRTOS-Kernel) version (see the Makefile) from its repository, as you did with the Mongoose repository.