Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
OneOfEleven committed Sep 9, 2023
1 parent 9230511 commit 54441e2
Show file tree
Hide file tree
Showing 3,388 changed files with 582,553 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
147 changes: 147 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
TARGET = firmware

BSP_DEFINITIONS := $(wildcard hardware/*/*.def)
BSP_HEADERS := $(patsubst hardware/%,bsp/%,$(BSP_DEFINITIONS))
BSP_HEADERS := $(patsubst %.def,%.h,$(BSP_HEADERS))

OBJS =
# Startup files
OBJS += start.o
OBJS += init.o
OBJS += sram-overlay.o
OBJS += external/printf/printf.o

# Drivers
OBJS += driver/adc.o
OBJS += driver/aes.o
OBJS += driver/backlight.o
OBJS += driver/bk1080.o
OBJS += driver/bk4819.o
OBJS += driver/crc.o
OBJS += driver/eeprom.o
OBJS += driver/flash.o
OBJS += driver/gpio.o
OBJS += driver/i2c.o
OBJS += driver/keyboard.o
OBJS += driver/spi.o
OBJS += driver/st7565.o
OBJS += driver/system.o
OBJS += driver/systick.o
OBJS += driver/uart.o

# Main
OBJS += app/action.o
OBJS += app/aircopy.o
OBJS += app/app.o
OBJS += app/dtmf.o
OBJS += app/fm.o
OBJS += app/generic.o
OBJS += app/main.o
OBJS += app/menu.o
OBJS += app/scanner.o
OBJS += app/uart.o
OBJS += audio.o
OBJS += bitmaps.o
OBJS += board.o
OBJS += dcs.o
OBJS += font.o
OBJS += frequencies.o
OBJS += functions.o
OBJS += helper/battery.o
OBJS += helper/boot.o
OBJS += misc.o
OBJS += radio.o
OBJS += scheduler.o
OBJS += settings.o
OBJS += ui/aircopy.o
OBJS += ui/battery.o
OBJS += ui/fmradio.o
OBJS += ui/helper.o
OBJS += ui/inputbox.o
OBJS += ui/lock.o
OBJS += ui/main.o
OBJS += ui/menu.o
OBJS += ui/rssi.o
OBJS += ui/scanner.o
OBJS += ui/status.o
OBJS += ui/ui.o
OBJS += ui/welcome.o
OBJS += version.o

OBJS += main.o

ifeq ($(OS),Windows_NT)
TOP := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
else
TOP := $(shell pwd)
endif

AS = arm-none-eabi-as
CC = arm-none-eabi-gcc
LD = arm-none-eabi-gcc
OBJCOPY = arm-none-eabi-objcopy
SIZE = arm-none-eabi-size

#GIT_HASH := $(shell git rev-parse --short HEAD)

ASFLAGS = -mcpu=cortex-m0
CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
#CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
LDFLAGS = -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld

# compilation options
CFLAGS += -DDISABLE_NOAA
CFLAGS += -DDISABLE_VOICE
CFLAGS += -DDISABLE_AIRCOPY
CFLAGS += -DKEEP_MEM_NAME
#CFLAGS += -DDISABLE_ALARM
#CFLAGS += -DBAND_SCOPE

ifeq ($(DEBUG),1)
ASFLAGS += -g
CFLAGS += -g
LDFLAGS += -g
endif

INC =
INC += -I $(TOP)
INC += -I $(TOP)/external/CMSIS_5/CMSIS/Core/Include/
INC += -I $(TOP)/external/CMSIS_5/Device/ARM/ARMCM0/Include

LIBS =

DEPS = $(OBJS:.o=.d)

all: $(TARGET)
$(OBJCOPY) -O binary $< $<.bin
# -python fw-pack.py $<.bin $(GIT_HASH) $<.packed.bin
# -python3 fw-pack.py $<.bin $(GIT_HASH) $<.packed.bin
$(SIZE) $<

debug:
/opt/openocd/bin/openocd -c "bindto 0.0.0.0" -f interface/jlink.cfg -f dp32g030.cfg

flash:
/opt/openocd/bin/openocd -c "bindto 0.0.0.0" -f interface/jlink.cfg -f dp32g030.cfg -c "write_image firmware.bin 0; shutdown;"

version.o: .FORCE

$(TARGET): $(OBJS)
$(LD) $(LDFLAGS) $^ -o $@ $(LIBS)

bsp/dp32g030/%.h: hardware/dp32g030/%.def

%.o: %.c | $(BSP_HEADERS)
$(CC) $(CFLAGS) $(INC) -c $< -o $@

%.o: %.S
$(AS) $(ASFLAGS) $< -o $@

.FORCE:

-include $(DEPS)

clean:
rm -f $(TARGET).bin $(TARGET) $(OBJS) $(DEPS)

70 changes: 70 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Open reimplementation of the Quan Sheng UV K5 v2.1.27 firmware

This repository is a cloned and customized version of DualTachyon's firmware found here ..

https://github.com/DualTachyon/uv-k5-firmware

# User customization

This version you can customize at compile time by making various changes to the makefile.
You can edit those changes by (currently) editing the MakeFile, look for these lines ..

"# compilation options"
"CFLAGS += -DDISABLE_NOAA" .. remove NOAA channels option from the firmware
"CFLAGS += -DDISABLE_VOICE" .. remove spoken VOICES option from the firmware
"CFLAGS += -DDISABLE_AIRCOPY" .. remove AIRCOPY option
"CFLAGS += -DKEEP_MEM_NAME" .. don't wipe out the memory channel's name when saving a memory channel
"#CFLAGS += -DDISABLE_ALARM" .. not yet implemented
"#CFLAGS += -DBAND_SCOPE" .. not yet implemented

To enable the custom option just uncomment the line by removing the starting '#'.

# Other changes made


# Compiler

arm-none-eabi GCC version 10.3.1 is recommended, which is the current version on Ubuntu 22.04.03 LTS.
Other versions may generate a flash file that is too big.
You can get an appropriate version from: https://developer.arm.com/downloads/-/gnu-rm

# Building

To build the firmware, you need to fetch the submodules and then run make:
```
git submodule update --init --recursive --depth=1
make
```

You can also easily compile this in windows (will an an example shortly) meaning you no longer have to install a linux VM on Windows.

# Credits

Many thanks to various people on Telegram for putting up with me during this effort and helping:

* [Mikhail](https://github.com/fagci/)
* [Andrej](https://github.com/Tunas1337)
* @wagner
* @Lohtse Shar
* [@Matoz](https://github.com/spm81)
* @Davide
* @Ismo OH2FTG
* and others I forget

# License

Copyright 2023 Dual Tachyon
https://github.com/DualTachyon

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Loading

0 comments on commit 54441e2

Please sign in to comment.