From a24facec2587646ec4ffd35dffcd1c96631aaf09 Mon Sep 17 00:00:00 2001 From: OneOfEleven Date: Sat, 16 Sep 2023 07:55:09 +0100 Subject: [PATCH] README.md --- Makefile | 8 ++++---- README.md | 45 +++++++++++++++++++++++++-------------------- driver/flash.c | 1 - sram-overlay.c | 48 ++++++++++++++++++------------------------------ 4 files changed, 47 insertions(+), 55 deletions(-) diff --git a/Makefile b/Makefile index 25e97dd..d022d7d 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ -# compile options -# you can enable ('1') or disable ('0') any/all of these you like +# compile options (see Readme.md) +# '0' = disable, 1 = enable ENABLE_SWD := 0 -ENABLE_AIRCOPY := 0 -ENABLE_FMRADIO := 0 ENABLE_OVERLAY := 1 ENABLE_UART := 1 +ENABLE_AIRCOPY := 0 +ENABLE_FMRADIO := 0 ENABLE_NOAA := 0 ENABLE_VOICE := 0 ENABLE_ALARM := 0 diff --git a/README.md b/README.md index 0a5a01b..3a2a8a1 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,41 @@ -# Open reimplementation of the Quan Sheng UV K5 v2.1.27 firmware +# Open reimplementation of the Quan Sheng UV-K5 v2.1.27 firmware This repository is a cloned and customized version of DualTachyon's open firmware found here .. https://github.com/DualTachyon/uv-k5-firmware -Am amazing achievement if you ask me ! +A cool achievement if you ask me # 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 at the top of the file .. +You can customize the firmware by enabling/disabling various compile options. +You'll find the options at the top of "makefile" ('0' = disable, '1' = enable) .. ``` +ENABLE_SWD := 0 enable only if you're using the CPU's SWD port (debugging/programming) +ENABLE_OVERLAY := 1 cpu FLASH stuff +ENABLE_UART := 1 without this you can't configure the radio with your PC ENABLE_AIRCOPY := 0 easier to just type frequency in ENABLE_FMRADIO := 0 FM band 2 RX -ENABLE_OVERLAY := 1 -ENABLE_UART := 1 without this you can't configure the radio with your PC -ENABLE_NOAA := 0 NOAA channels -ENABLE_VOICE := 0 strange voices +ENABLE_NOAA := 0 Everything NOAA +ENABLE_VOICE := 0 want to hear voices ? ENABLE_ALARM := 0 TX alarms ENABLE_BIG_FREQ := 0 big font for the frequencies ENABLE_KEEP_MEM_NAME := 1 maintain the channel name when (re)saving a memory channel ENABLE_CHAN_NAME_FREQ := 1 show the channel frequency below the channel name/number -ENABLE_WIDE_RX := 1 enable the RX in the full 18MHz to 1300MHz (though frontend is not tuned for full range) -ENABLE_TX_WHEN_AM := 0 allow TX when RX set to AM -ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 use CTCSS tail phase shift rather than QS's 55Hz tone method -ENABLE_MAIN_KEY_HOLD := 1 keys 0-9 can be held down to bypass having to press the F-key -ENABLE_BOOT_BEEPS := 1 gives the user some audio feedback on the volume level knob position at boot-up -ENABLE_COMPANDER := 1 compander menu option - not yet fully operational -#ENABLE_SINGLE_VFO_CHAN := 1 not yet implemented -#ENABLE_BAND_SCOPE := 1 not yet implemented +ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz for RX (though frontend is not tuned for full range) +ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM +ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 use standard CTCSS tail phase shift rather than QS's own 55Hz tone method +ENABLE_MAIN_KEY_HOLD := 1 keys 0-9 can be held down to bypass having to first press the F-key +ENABLE_BOOT_BEEPS := 1 give user audio feedback on the volume knob position at boot-up +ENABLE_COMPANDER := 1 compander option - not yet fully operational +#ENABLE_SINGLE_VFO_CHAN := 1 not yet implemented - single VFO on display when possible +#ENABLE_BAND_SCOPE := 1 not yet implemented - spectrum/pan-adapter ``` -To enable the custom option, set the above option to '1' - # Some other changes made -* Various original QS firmware bugs fixed +* Various QS firmware bugs fixed * Added new bugs * Finer RSSI bar steps * Nicer/cleaner big numeric font than original QS big numeric font @@ -67,7 +66,7 @@ To compile directly in windows without the need of a linux virtual machine: ``` Then you can run 'win_make.bat' from the directory you saved this source code too. -You may need to edit the bat file (path to make.exe) depending on where you installed 'gnu_make' too. +You may need to edit the bat file (path to make.exe) depending on where you installed the above two packages too. # Credits @@ -102,3 +101,9 @@ You may obtain a copy of the License at See the License for the specific language governing permissions and limitations under the License. +# Example changes + +

+ + +

diff --git a/driver/flash.c b/driver/flash.c index f0b56f5..aa4116d 100644 --- a/driver/flash.c +++ b/driver/flash.c @@ -31,4 +31,3 @@ uint32_t FLASH_ReadNvrWord(uint32_t Address) { return overlay_FLASH_ReadNvrWord(Address); } - diff --git a/sram-overlay.c b/sram-overlay.c index 3be849e..844351e 100644 --- a/sram-overlay.c +++ b/sram-overlay.c @@ -21,9 +21,9 @@ #include "sram-overlay.h" static volatile uint32_t *pFlash = 0; -uint32_t overlay_FLASH_MainClock; -uint32_t overlay_FLASH_ClockMultiplier; -uint32_t overlay_0x20000478; // Nothing is using this??? +uint32_t overlay_FLASH_MainClock; +uint32_t overlay_FLASH_ClockMultiplier; +uint32_t overlay_0x20000478; // Nothing is using this??? void overlay_FLASH_RebootToBootloader(void) { @@ -94,16 +94,14 @@ uint32_t overlay_FLASH_ReadByAPB(uint32_t Offset) { uint32_t Data; - while (overlay_FLASH_IsBusy()) { - } + while (overlay_FLASH_IsBusy()) {} overlay_FLASH_SetMode(FLASH_MODE_READ_APB); FLASH_ADDR = Offset >> 2; overlay_FLASH_Start(); - while (overlay_FLASH_IsBusy()) { - } + while (overlay_FLASH_IsBusy()) {} Data = FLASH_RDATA; @@ -120,11 +118,11 @@ void overlay_FLASH_SetArea(FLASH_AREA Area) void overlay_FLASH_SetReadMode(FLASH_READ_MODE Mode) { - if (Mode == FLASH_READ_MODE_1_CYCLE) { + if (Mode == FLASH_READ_MODE_1_CYCLE) FLASH_CFG = (FLASH_CFG & ~FLASH_CFG_READ_MD_MASK) | FLASH_CFG_READ_MD_BITS_1_CYCLE; - } else if (Mode == FLASH_READ_MODE_2_CYCLE) { + else + if (Mode == FLASH_READ_MODE_2_CYCLE) FLASH_CFG = (FLASH_CFG & ~FLASH_CFG_READ_MD_MASK) | FLASH_CFG_READ_MD_BITS_2_CYCLE; - } } void overlay_FLASH_SetEraseTime(void) @@ -135,8 +133,7 @@ void overlay_FLASH_SetEraseTime(void) void overlay_FLASH_WakeFromDeepSleep(void) { FLASH_CFG = (FLASH_CFG & ~FLASH_CFG_DEEP_PD_MASK) | FLASH_CFG_DEEP_PD_BITS_NORMAL; - while (!overlay_FLASH_IsInitComplete()) { - } + while (!overlay_FLASH_IsInitComplete()) {} } void overlay_FLASH_SetMode(FLASH_MODE Mode) @@ -153,28 +150,20 @@ void overlay_SystemReset(void) { // Lifted from core_cm0.h to preserve function order in the object file. - __DSB(); /* Ensure all outstanding memory accesses included - buffered write are completed before reset */ - SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | - SCB_AIRCR_SYSRESETREQ_Msk); - __DSB(); /* Ensure completion of memory access */ + __DSB(); // Ensure all outstanding memory accesses included buffered write are completed before reset + SCB->AIRCR = (0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | SCB_AIRCR_SYSRESETREQ_Msk; + __DSB(); // Ensure completion of memory access - for(;;) /* wait until reset */ - { + for (;;) // wait until reset __NOP(); - } } uint32_t overlay_FLASH_ReadNvrWord(uint32_t Offset) { uint32_t Data; - overlay_FLASH_SetArea(FLASH_AREA_NVR); - Data = overlay_FLASH_ReadByAHB(Offset); - overlay_FLASH_SetArea(FLASH_AREA_MAIN); - return Data; } @@ -189,22 +178,21 @@ void overlay_FLASH_ConfigureTrimValues(void) SYSCON_CHIP_ID2 = overlay_FLASH_ReadByAPB(0xF020); SYSCON_CHIP_ID3 = overlay_FLASH_ReadByAPB(0xF024); - SYSCON_RC_FREQ_DELTA = overlay_FLASH_ReadByAHB(0x07C8); + SYSCON_RC_FREQ_DELTA = overlay_FLASH_ReadByAHB(0x07C8); SYSCON_VREF_VOLT_DELTA = overlay_FLASH_ReadByAHB(0x07C4); PMU_TRIM_POW0 = overlay_FLASH_ReadByAHB(0x07E4); PMU_TRIM_POW1 = overlay_FLASH_ReadByAHB(0x07E0); PMU_TRIM_RCHF = overlay_FLASH_ReadByAHB(0x07D8); PMU_TRIM_RCLF = overlay_FLASH_ReadByAHB(0x07D4); - PMU_TRIM_OPA = overlay_FLASH_ReadByAHB(0x07D0); - PMU_TRIM_PLL = overlay_FLASH_ReadByAHB(0x07CC); + PMU_TRIM_OPA = overlay_FLASH_ReadByAHB(0x07D0); + PMU_TRIM_PLL = overlay_FLASH_ReadByAHB(0x07CC); overlay_0x20000478 = overlay_FLASH_ReadByAHB(0x07B8); - Data = overlay_FLASH_ReadByAHB(0x07BC); + Data = overlay_FLASH_ReadByAHB(0x07BC); SYSCON_DEV_CLK_GATE = (SYSCON_DEV_CLK_GATE & ~SYSCON_DEV_CLK_GATE_SARADC_MASK) | SYSCON_DEV_CLK_GATE_SARADC_BITS_ENABLE; SARADC_CALIB_OFFSET = ((Data & 0xFFFF) << SARADC_CALIB_OFFSET_OFFSET_SHIFT) & SARADC_CALIB_OFFSET_OFFSET_MASK; - SARADC_CALIB_KD = (((Data >> 16) & 0xFFFF) << SARADC_CALIB_KD_KD_SHIFT) & SARADC_CALIB_KD_KD_MASK; + SARADC_CALIB_KD = (((Data >> 16) & 0xFFFF) << SARADC_CALIB_KD_KD_SHIFT) & SARADC_CALIB_KD_KD_MASK; overlay_FLASH_SetArea(FLASH_AREA_MAIN); } -