# HG changeset patch # User Ideenmodellierer # Date 1723494183 -7200 # Node ID 4e10a3e087a115431d2a7231da3b2717d3256d03 # Parent db92692c014f75d9c43704bc7ae17c5cdf0dda19 Reactivate Bootloader: The bootloader has not been compiled for a long time. Changes were necessary to catch up with the actual code diff -r db92692c014f -r 4e10a3e087a1 BootLoader/CPU1-F429_boot.ld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BootLoader/CPU1-F429_boot.ld Mon Aug 12 22:23:03 2024 +0200 @@ -0,0 +1,597 @@ +/***************************************************************************** + * -*- coding: UTF-8 -*- + * + * \file Common/CPU1-F429.ld + * \brief Linker Script for CPU1 alias Discovery + * \author Ac6 workbench, Heinrichs Weikamp, and JD Gascuel + * \date 2018 + * + * \details + * Linker script for STM32F429IIT6 Device from STM32F4 series + * - 192Kbytes RAM + * - 2048Kbytes ROM + * + * Set heap size, stack size and stack location according + * to application requirements. + * + * Set memory bank area and size if external memory is used. + * + * $Id$ + ***************************************************************************** + * \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh + * + * This program 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. + * + * This program 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 . + ***************************************************************************** + * HISTORY + * 2017-12-18 jDG: Mix between std AC6 file and chw stm32f429zi_flash.ld settings. + */ + +/* Entry Point */ +ENTRY(Reset_Handler) + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/****************************************************************************/ +/***************************** Memory Definition ****************************/ +MEMORY +{ + ROM_BOOT (rx) : ORIGIN = 0x08000000, LENGTH = 0x00040000 /* 256K */ + ROM (rx) : ORIGIN = 0x08040000, LENGTH = 0x00090000 /* 576K */ + UPPER(rx) : ORIGIN = 0x08132000, LENGTH = 0xAE270 /* 713K */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 192K + CCRAM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K +} + +/* Linker file shall be shared between Bootloader, Font and Firmware projects. Not used memory areas to be cut during bin generation */ + +/* Make sure ROM and UPPER are contiguous, and map 2MB */ +/* TODO: At the moment the size of the defined memory will be directly reflected into the file size of resultion bin => Keep small until not used memory may be excluded from build */ +/*ASSERT( ORIGIN(UPPER) - ORIGIN(ROM) == LENGTH(ROM), "ROM lower and upper region shall be continuous" ) +/*ASSERT( LENGTH(ROM) + LENGTH(UPPER) == 2048K, "ROM lower + upper regions = 2MB" ) */ + +/* Highest address of the user mode stack */ +/*_estack = ORIGIN(RAM) + LENGTH(RAM);*/ + + +_Min_Heap_Size = 0; /* no required heap (malloc'ed space) */ +_Min_Stack_Size = 0x08000; /* required 32K of stack */ + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * _sbss + * __bss_start__ + * _ebss + * __bss_end__ + * _edata + * end + * _end + * _estack + */ + +/****************************************************************************/ +/*************************** Code and Data Sections *************************/ +SECTIONS +{ + /******************* NVIC reset and interupt vectors **********************/ + + .isr_vector 0x08000000 : + { + . = ALIGN(4); + KEEP( *(.isr_vector) ) + KEEP(*(.init)) + } >ROM_BOOT + + + .StdLibs 0x08000200: + { + . = ALIGN(4); + *libm.a:*(*) + } >ROM_BOOT + + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >ROM_BOOT + + /********************** Constant data into ROM memory *********************/ + + + .ARM.extab : { + . = ALIGN(4); + *(.ARM.extab* .gnu.linkonce.armextab.*) + . = ALIGN(4); + } >ROM_BOOT + + .ARM : { + . = ALIGN(4); + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + . = ALIGN(4); + } >ROM_BOOT + + .preinit_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN( __preinit_array_start = . ); + KEEP( *(.preinit_array*) ) + PROVIDE_HIDDEN( __preinit_array_end = . ); + . = ALIGN(4); + } >ROM_BOOT + + .init_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN( __init_array_start = . ); + KEEP( *(SORT(.init_array.*)) ) + KEEP( *(.init_array*) ) + PROVIDE_HIDDEN( __init_array_end = . ); + . = ALIGN(4); + } >ROM_BOOT + + .fini_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN( __fini_array_start = . ); + KEEP( *(SORT(.fini_array.*)) ) + KEEP( *(.fini_array*) ) + PROVIDE_HIDDEN( __fini_array_end = . ); + . = ALIGN(4); + } >ROM_BOOT + + /************* The program code and other data into ROM memory ************/ + +/* + .firmware_FirmwareData 0x08050000 : { + KEEP( *(.firmware_firmware_data) ) + } >ROM + + .font_firmware_data 0x08132000 : { + KEEP( *(.font_firmware_data) ) + + } >UPPER + */ + + /************* Data and Structures at absolute address in ROM *************/ + + /* FIXME: this sets the SFirmwareData structure, not the code ... */ + .bootloader_firmware_data 0x0800A000 : { + PROVIDE( bootloader_FirmwareData = . ); + KEEP( *(.bootloader_firmware_data) ) + } > ROM_BOOT + + + + .text 0x08001000 : + { + . = ALIGN(4); + *(.text.HAL*) + . = ALIGN(4); + } >ROM_BOOT + + + .text2 0x0800A100 : + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >ROM_BOOT + + + + /* Define Known Address for Each Font */ + /* Flash Sector 23 is protected (bootloader font + image) => use end of sector 22 */ + +.lower_fonts 0x08016000 : { + *(.lower_fonts.image_data_*) + *(.lower_fonts.*) + *(.upper_fonts.image_data_FontT48*) + *(.upper_fonts.FontT48*) + *(.upper_fonts.image_data_FontT24*) + *(.upper_fonts.FontT24*) +} > ROM_BOOT + +.lower_directory 0x08004000 : { + *(.lower_font_directory*) + *(.upper_font_directory.FontT48*) + *(.upper_font_directory.FontT24*) +} > ROM_BOOT + + +.lower_image 0x08009000 : { + *(.lower_image*) + +} > ROM_BOOT + +.lower_directory 0x08009500 : { + *(.lower_image_directory*) +} > ROM_BOOT + + .upper_fonts 0x08132040 : { + __upper_font_data = .; + . = 0x13E; + *(.upper_fonts.image_data_FontT144_0x0030) + . = 0x02515; + *(.upper_fonts.image_data_FontT144_0x0031) + . = 0x03469; + *(.upper_fonts.image_data_FontT144_0x0032) + . = 0x4FDC; + *(.upper_fonts.image_data_FontT144_0x0033) + . = 0x6862; + *(.upper_fonts.image_data_FontT144_0x0034) + . = 0x86C2; + *(.upper_fonts.image_data_FontT144_0x0035) + . = 0x9FB3; + *(.upper_fonts.image_data_FontT144_0x0036) + . = 0xBB26; + *(.upper_fonts.image_data_FontT144_0x0037) + . = 0xD845; + *(.upper_fonts.image_data_FontT144_0x0038) + . = 0xF34D; + *(.upper_fonts.image_data_FontT144_0x0039) + . = 0x10EC0; + *(.upper_fonts.image_data_FontT24_0x0020) + *(.upper_fonts.image_data_FontT24_0x0021) + *(.upper_fonts.image_data_FontT24_0x0022) + *(.upper_fonts.image_data_FontT24_0x0023) + *(.upper_fonts.image_data_FontT24_0x0024) + *(.upper_fonts.image_data_FontT24_0x0025) + *(.upper_fonts.image_data_FontT24_0x0026) + *(.upper_fonts.image_data_FontT24_0x0027) + *(.upper_fonts.image_data_FontT24_0x0028) + *(.upper_fonts.image_data_FontT24_0x0029) + *(.upper_fonts.image_data_FontT24_0x002a) + *(.upper_fonts.image_data_FontT24_0x003f) + *(.upper_fonts.image_data_FontT24_0x002c) + *(.upper_fonts.image_data_FontT24_0x002d) + *(.upper_fonts.image_data_FontT24_0x002e) + *(.upper_fonts.image_data_FontT24_0x002f) + *(.upper_fonts.image_data_FontT24_0x0030) + *(.upper_fonts.image_data_FontT24_0x0031) + *(.upper_fonts.image_data_FontT24_0x0032) + *(.upper_fonts.image_data_FontT24_0x0033) + *(.upper_fonts.image_data_FontT24_0x0034) + *(.upper_fonts.image_data_FontT24_0x0035) + *(.upper_fonts.image_data_FontT24_0x0036) + *(.upper_fonts.image_data_FontT24_0x0037) + *(.upper_fonts.image_data_FontT24_0x0038) + *(.upper_fonts.image_data_FontT24_0x0039) + *(.upper_fonts.image_data_FontT24_0x003a) + *(.upper_fonts.image_data_FontT24_0x003b) + *(.upper_fonts.image_data_FontT24_0x003c) + *(.upper_fonts.image_data_FontT24_0x003d) + *(.upper_fonts.image_data_FontT24_0x003e) + . = . + 0x8c; + *(.upper_fonts.image_data_FontT24_0x0040) + *(.upper_fonts.image_data_FontT24_0x0041) + *(.upper_fonts.image_data_FontT24_0x0042) + *(.upper_fonts.image_data_FontT24_0x0043) + *(.upper_fonts.image_data_FontT24_0x0044) + *(.upper_fonts.image_data_FontT24_0x0045) + *(.upper_fonts.image_data_FontT24_0x0046) + *(.upper_fonts.image_data_FontT24_0x0047) + *(.upper_fonts.image_data_FontT24_0x0048) + *(.upper_fonts.image_data_FontT24_0x0049) + *(.upper_fonts.image_data_FontT24_0x004a) + *(.upper_fonts.image_data_FontT24_0x004b) + *(.upper_fonts.image_data_FontT24_0x004c) + *(.upper_fonts.image_data_FontT24_0x004d) + *(.upper_fonts.image_data_FontT24_0x004e) + *(.upper_fonts.image_data_FontT24_0x004f) + *(.upper_fonts.image_data_FontT24_0x0050) + *(.upper_fonts.image_data_FontT24_0x0051) + *(.upper_fonts.image_data_FontT24_0x0052) + *(.upper_fonts.image_data_FontT24_0x0053) + *(.upper_fonts.image_data_FontT24_0x0054) + *(.upper_fonts.image_data_FontT24_0x0055) + *(.upper_fonts.image_data_FontT24_0x0056) + *(.upper_fonts.image_data_FontT24_0x0057) + *(.upper_fonts.image_data_FontT24_0x0058) + *(.upper_fonts.image_data_FontT24_0x0059) + *(.upper_fonts.image_data_FontT24_0x005a) + *(.upper_fonts.image_data_FontT24_0x005b) + *(.upper_fonts.image_data_FontT24_0x005c) + *(.upper_fonts.image_data_FontT24_0x005d) + *(.upper_fonts.image_data_FontT24_0x005e) + *(.upper_fonts.image_data_FontT24_0x005f) + *(.upper_fonts.image_data_FontT24_0x0060) + *(.upper_fonts.image_data_FontT24_0x0061) + *(.upper_fonts.image_data_FontT24_0x0062) + *(.upper_fonts.image_data_FontT24_0x0063) + . = . + 0x1c; + *(.upper_fonts.image_data_FontT24_0x0064) + *(.upper_fonts.image_data_FontT24_0x0065) + *(.upper_fonts.image_data_FontT24_0x0066) + *(.upper_fonts.image_data_FontT24_0x0067) + *(.upper_fonts.image_data_FontT24_0x0068) + *(.upper_fonts.image_data_FontT24_0x0069) + *(.upper_fonts.image_data_FontT24_0x006a) + *(.upper_fonts.image_data_FontT24_0x006b) + *(.upper_fonts.image_data_FontT24_0x006c) + *(.upper_fonts.image_data_FontT24_0x006d) + *(.upper_fonts.image_data_FontT24_0x006e) + *(.upper_fonts.image_data_FontT24_0x006f) + *(.upper_fonts.image_data_FontT24_0x0070) + *(.upper_fonts.image_data_FontT24_0x0071) + *(.upper_fonts.image_data_FontT24_0x0072) + *(.upper_fonts.image_data_FontT24_0x0073) + *(.upper_fonts.image_data_FontT24_0x0074) + *(.upper_fonts.image_data_FontT24_0x0075) + *(.upper_fonts.image_data_FontT24_0x0076) + *(.upper_fonts.image_data_FontT24_0x0077) + *(.upper_fonts.image_data_FontT24_0x0078) + *(.upper_fonts.image_data_FontT24_0x0079) + *(.upper_fonts.image_data_FontT24_0x007a) + *(.upper_fonts.image_data_FontT24_0x007b) + *(.upper_fonts.image_data_FontT24_0x007c) + . = . + 0x1c; + *(.upper_fonts.image_data_FontT24_0x007d) + *(.upper_fonts.image_data_FontT24_0x007e) + *(.upper_fonts.image_data_FontT24_0x00a1) + *(.upper_fonts.image_data_FontT24_0x00bf) + *(.upper_fonts.image_data_FontT24_0x00c1) + *(.upper_fonts.image_data_FontT24_0x00c4) + *(.upper_fonts.image_data_FontT24_0x00c6) + *(.upper_fonts.image_data_FontT24_0x00c7) + *(.upper_fonts.image_data_FontT24_0x00c9) + *(.upper_fonts.image_data_FontT24_0x00cd) + *(.upper_fonts.image_data_FontT24_0x00d1) + *(.upper_fonts.image_data_FontT24_0x00d3) + *(.upper_fonts.image_data_FontT24_0x00d6) + *(.upper_fonts.image_data_FontT24_0x00da) + *(.upper_fonts.image_data_FontT24_0x00dc) + *(.upper_fonts.image_data_FontT24_0x00df) + *(.upper_fonts.image_data_FontT24_0x00e0) + *(.upper_fonts.image_data_FontT24_0x00e1) + *(.upper_fonts.image_data_FontT24_0x00e2) + *(.upper_fonts.image_data_FontT24_0x00e4) + *(.upper_fonts.image_data_FontT24_0x00e6) + *(.upper_fonts.image_data_FontT24_0x00e7) + *(.upper_fonts.image_data_FontT24_0x00e8) + *(.upper_fonts.image_data_FontT24_0x00e9) + *(.upper_fonts.image_data_FontT24_0x00ec) + *(.upper_fonts.image_data_FontT24_0x00ed) + *(.upper_fonts.image_data_FontT24_0x00f0) + *(.upper_fonts.image_data_FontT24_0x00f1) + *(.upper_fonts.image_data_FontT24_0x00f2) + *(.upper_fonts.image_data_FontT24_0x00f3) + *(.upper_fonts.image_data_FontT24_0x00f6) + *(.upper_fonts.image_data_FontT24_0x00f9) + *(.upper_fonts.image_data_FontT24_0x00fa) + *(.upper_fonts.image_data_FontT24_0x00fc) + *(.upper_fonts.image_data_FontT24_0x00ff) + *(.upper_fonts.image_data_FontT24_0x0152) + *(.upper_fonts.image_data_FontT24_0x0153) + *(.upper_fonts.image_data_FontT24_0x0178) + *(.upper_fonts.image_data_FontT24_0x002b) + . = . + 0x1d642; + *(.upper_images.image_data_ostc_fuer_Tauchcomputer_240px) + *(.upper_fonts.image_data_FontT84_0x002e) + . = . + 0x9f; + *(.upper_fonts.image_data_FontT84_0x0030) + . = . + 0x0d; + *(.upper_fonts.image_data_FontT84_0x0031) + . = . + 0xaa; + *(.upper_fonts.image_data_FontT84_0x0032) + . = . + 0x7b; + *(.upper_fonts.image_data_FontT84_0x0033) + . = . + 0x38; + *(.upper_fonts.image_data_FontT84_0x0034) + . = . + 0x7f; + *(.upper_fonts.image_data_FontT84_0x0035) + . = . + 0x77; + *(.upper_fonts.image_data_FontT84_0x0036) + . = . + 0x7b; + *(.upper_fonts.image_data_FontT84_0x0037) + . = . + 0x0d; + *(.upper_fonts.image_data_FontT84_0x0038) + . = . + 0x2b; + *(.upper_fonts.image_data_FontT84_0x0039) + . = . + 0xe8; + *(.upper_fonts.image_data_FontT54_0x0022) + *(.upper_fonts.image_data_FontT54_0x0025) + . = . + 0x112; + *(.upper_fonts.image_data_FontT54_0x0027) + . = . + 0xd8; + *(.upper_fonts.image_data_FontT54_0x002a) + . = . + 0x133; + *(.upper_fonts.image_data_FontT54_0x002d) + . = . + 0x1d7; + *(.upper_fonts.image_data_FontT54_0x002e) + . = . + 0x17b; + *(.upper_fonts.image_data_FontT54_0x002f) + . = . + 0x02; + *(.upper_fonts.image_data_FontT54_0x0030) + . = . + 0x0ba; + *(.upper_fonts.image_data_FontT54_0x0031) + . = . + 0x27d; + *(.upper_fonts.image_data_FontT54_0x0032) + . = . + 0xe3; + *(.upper_fonts.image_data_FontT54_0x0033) + . = . + 0x35; + *(.upper_fonts.image_data_FontT54_0x0034) + . = . + 0x68; + *(.upper_fonts.image_data_FontT54_0x0035) + . = . + 0x35; + *(.upper_fonts.image_data_FontT54_0x0036) + . = . + 0xba; + *(.upper_fonts.image_data_FontT54_0x0037) + . = . + 0x191; + *(.upper_fonts.image_data_FontT54_0x0038) + . = . + 0xe3; + *(.upper_fonts.image_data_FontT54_0x0039) + . = . + 0xe3; + *(.upper_fonts.image_data_FontT54_0x003a) + . = . + 0x7b; + *(.upper_fonts.image_data_FontT54_0x0043) + . = . + 0x3b; + *(.upper_fonts.image_data_FontT54_0x006c) + . = . + 0x2d; + *(.upper_fonts.image_data_FontT54_0x006d) + . = . + 0x94; + *(.upper_fonts.image_data_FontT54_0x00ba) + . = . + 0x0a; + + *(.upper_fonts.image_data_FontT105_0x002*) + *(.upper_fonts.image_data_FontT105_0x003*) + *(.upper_fonts.image_data_FontT105_0x0043) + . = . + 0x17c8; + *(.upper_fonts.image_data_FontT105_0x007c) + *(.upper_fonts.image_data_FontT105_0x00ba) + *(.upper_fonts.image_data_FontT105_54_0x006d) + + *(.upper_fonts.image_data_FontT54_0x0068) + . = . + 0x1195; + + *(.upper_fonts.image_data_FontT42_0x00b0) + *(.upper_fonts.image_data_FontT42_0x0020) + . = . + 0x23; + *(.upper_fonts.image_data_FontT42_0x002*) + *(.upper_fonts.image_data_FontT42_0x003*) + *(.upper_fonts.image_data_FontT42_0x004*) + *(.upper_fonts.image_data_FontT42_0x005*) + . = . + 0x420; + *(.upper_fonts.image_data_FontT42_0x006*) + *(.upper_fonts.image_data_FontT42_0x0070) + *(.upper_fonts.image_data_FontT42_0x0071) + *(.upper_fonts.image_data_FontT42_0x0072) + *(.upper_fonts.image_data_FontT42_0x0073) + *(.upper_fonts.image_data_FontT42_0x0074) + *(.upper_fonts.image_data_FontT42_0x0075) + *(.upper_fonts.image_data_FontT42_0x0076) + *(.upper_fonts.image_data_FontT42_0x0077) + *(.upper_fonts.image_data_FontT42_0x0078) + *(.upper_fonts.image_data_FontT42_0x0079) + . = . + 0x12c0; + *(.upper_fonts.image_data_FontT42_*) + *(.upper_fonts.image_data_T54addon_0x002b_PLUS*) + *(.upper_fonts.image_data_T54addon_0x0040_AT*) + *(.upper_fonts.image_data_FontT48addon*) + *(.upper_fonts.image_data_FontT24plus_0x00fb*) + *(.upper_fonts.image_data_FontT24plus_0x00fd*) + *(.upper_fonts.image_data_FontT48_*) + *(.upper_fonts.image_data_awe48_*) + +/* moving of fonts from lower to upper */ + + *(.upper_fonts.*) + + __upper_font_data_end = .; + } >UPPER + + + + .upper_directory 0x081DEF00 : { + __font_directory = .; + *(.upper_font_directory.Awe48) + *(.upper_font_directory.FontT24) + *(.upper_font_directory.FontT42) + *(.upper_font_directory.FontT48) + *(.upper_font_directory.FontT54) + *(.upper_font_directory.FontT84) + *(.upper_font_directory.FontT105) + *(.upper_font_directory.FontT144) + *(.upper_font_directory.Batt24*) + + __font_directory_end = .; + LONG( -1 ); /* Magic End Marker */ + + } >UPPER + + + + + + /* Used by the startup to initialize data */ +_sidata = LOADADDR(.data); + + /************ Initialized Data Sections into RAM & ROM Memory **************/ + .data : + { + . = ALIGN(4); + + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + *(vtable) + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM AT>ROM_BOOT + + + + /*************** Uninitialized Data Section into RAM Memory ****************/ + .bss : + { + . = ALIGN(4); + + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /********************** User_heap_stack section ****************************/ + /* just to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + PROVIDE ( __end__ = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + _estack = .; + } >RAM + + /* Remove information from the compiler libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff -r db92692c014f -r 4e10a3e087a1 BootLoader/Inc/base_bootloader.h --- a/BootLoader/Inc/base_bootloader.h Mon Aug 12 15:14:19 2024 +0200 +++ b/BootLoader/Inc/base_bootloader.h Mon Aug 12 22:23:03 2024 +0200 @@ -59,9 +59,6 @@ #define BASE_BOOTLOADER_H /* Includes ------------------------------------------------------------------*/ - -#define STM32F429xx - #include "stm32f4xx_hal.h" #include "tStructure.h" diff -r db92692c014f -r 4e10a3e087a1 BootLoader/Src/base_bootlader.c --- a/BootLoader/Src/base_bootlader.c Mon Aug 12 15:14:19 2024 +0200 +++ b/BootLoader/Src/base_bootlader.c Mon Aug 12 22:23:03 2024 +0200 @@ -223,6 +223,19 @@ #include "stm32f4xx_hal_flash_ex.h" #include "stm32f4xx_hal_wwdg.h" +#ifdef BOOTLOADER_STANDALONE +#include "Fonts/Font_T144_plus.h" +#include "Fonts/Font_T84.h" +#include "Fonts/Font_T105.h" +#include "Fonts/Font_T54.h" +#include "Fonts/Font_T48_plus.h" +#include "Fonts/Font_T24.h" +#include "Fonts/Font_T42.h" +#include "Fonts/image_battery.h" +#include "Fonts/image_heinrichs_weikamp.h" +#include "Fonts/image_ostc.h" +#endif + // From Discovery/Inc (shall be shared...) #include "data_exchange_main.h" #include "display.h" @@ -269,7 +282,7 @@ .magic[3] = FIRMWARE_MAGIC_END }; - +#if 0 const SHardwareData HardwareData __attribute__((at(HARDWAREDATA_ADDRESS))) = { // first 52 bytes @@ -297,7 +310,7 @@ .secondary_bluetooth_name_set = 0xFF, .secondary_info = {0xFF,0xFF,0xFF,0xFF} }; - +#endif RTC_HandleTypeDef RtcHandle; TIM_HandleTypeDef TimHandle; /* used in stm32f4xx_it.c too */ @@ -418,10 +431,15 @@ uint8_t ptr; uint32_t pOffset; + const SHardwareData* HardwareData = hardwareDataGetPointer(); + set_globalState(StBoot0); HAL_Init(); HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_2); + SystemClock_Config(); + + MX_GPIO_Init(); /* feedback for the user * aber sehr unsch�n beim Warmstart @@ -442,8 +460,8 @@ } else if( (firmware_MainCodeIsProgammed() == 0) - || (hardwareDataGetPointer()->primarySerial == 0xFFFF) - || (hardwareDataGetPointer()->production_bluetooth_name_set == 0xFF)) + || (HardwareData->primarySerial == 0xFFFF) + || (HardwareData->production_bluetooth_name_set == 0xFF)) { i = 1; } @@ -495,9 +513,8 @@ if((i == 0) && (callForUpdate == 0)) firmware_JumpTo_Application(); - SystemClock_Config(); - MX_GPIO_Init(); + MX_Bluetooth_PowerOn(); MX_SPI_Init(); SDRAM_Config(); @@ -663,7 +680,7 @@ textVersion[ptr++] = 'a'; textVersion[ptr++] = 'l'; textVersion[ptr++] = ' '; - if(HardwareData.primarySerial == 0xFFFF) + if(HardwareData->primarySerial == 0xFFFF) { textVersion[ptr++] = 'n'; textVersion[ptr++] = 'o'; @@ -673,25 +690,25 @@ textVersion[ptr++] = 'e'; textVersion[ptr++] = 't'; } - else if(HardwareData.secondarySerial == 0xFFFF) + else if(HardwareData->secondarySerial == 0xFFFF) { textVersion[ptr++] = '#'; - ptr += gfx_number_to_string(5,1,&textVersion[ptr],HardwareData.primarySerial); + ptr += gfx_number_to_string(5,1,&textVersion[ptr],HardwareData->primarySerial); } else { textVersion[ptr++] = '#'; - ptr += gfx_number_to_string(5,1,&textVersion[ptr],HardwareData.secondarySerial); + ptr += gfx_number_to_string(5,1,&textVersion[ptr],HardwareData->secondarySerial); textVersion[ptr++] = ' '; textVersion[ptr++] = '('; - ptr += gfx_number_to_string(5,1,&textVersion[ptr],HardwareData.primarySerial); + ptr += gfx_number_to_string(5,1,&textVersion[ptr],HardwareData->primarySerial); textVersion[ptr++] = ')'; } textVersion[ptr++] = '\020'; textVersion[ptr] = 0; tInfo_button_text("Exit","","Sleep"); - tInfo_newpage("Bootloader 160602"); + tInfo_newpage("Bootloader 240812"); tInfo_write("start bluetooth"); tInfo_write(""); tInfo_write(textVersion); @@ -701,8 +718,9 @@ MX_UART_Init(); MX_Bluetooth_PowerOn(); tComm_Set_Bluetooth_Name(0); + tComm_init(); + tComm_StartBlueModConfig(); - tComm_init(); set_globalState_Base(); GFX_start_VSYNC_IRQ(); @@ -1153,54 +1171,65 @@ */ static void SystemClock_Config(void) { - RCC_ClkInitTypeDef RCC_ClkInitStruct; - RCC_OscInitTypeDef RCC_OscInitStruct; - RCC_PeriphCLKInitTypeDef PeriphClkInitStruct; + /* Enable Power Control clock */ + __PWR_CLK_ENABLE(); - /* Enable Power Control clock */ - __PWR_CLK_ENABLE(); - - /* The voltage scaling allows optimizing the power consumption when the device is - clocked below the maximum system frequency, to update the voltage scaling value - regarding system frequency refer to product datasheet. */ - __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); + /* The voltage scaling allows optimizing the power consumption when the device is + clocked below the maximum system frequency, to update the voltage scaling value + regarding system frequency refer to product datasheet. */ + __HAL_PWR_VOLTAGESCALING_CONFIG( PWR_REGULATOR_VOLTAGE_SCALE1 ); - /*##-1- System Clock Configuration #########################################*/ - /* Enable HSE Oscillator and activate PLL with HSE as source */ - RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; - RCC_OscInitStruct.HSEState = RCC_HSE_ON; - RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; - RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; - RCC_OscInitStruct.PLL.PLLM = 8; - RCC_OscInitStruct.PLL.PLLN = 336;//360; - RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; - RCC_OscInitStruct.PLL.PLLQ = 7; - HAL_RCC_OscConfig(&RCC_OscInitStruct); + /*##-1- System Clock Configuration #########################################*/ + /* Enable HighSpeed Oscillator and activate PLL with HSE/HSI as source */ + RCC_OscInitTypeDef RCC_OscInitStruct = { 0 }; +#ifdef DISC1_BOARD + // Use High Speed Internal (HSI) oscillator, running at 16MHz. + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; + RCC_OscInitStruct.HSIState = RCC_HSI_ON; + RCC_OscInitStruct.HSICalibrationValue = 0x10; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; + RCC_OscInitStruct.PLL.PLLM = 16; // HSI/16 is 1Mhz. +#else + // Use High Speed External oscillator, running at 8MHz + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; + RCC_OscInitStruct.HSEState = RCC_HSE_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; + RCC_OscInitStruct.PLL.PLLM = 8; // HSE/8 is 1Mhz. +#endif + // System clock = PLL (1MHz) * N/p = 180 MHz. + RCC_OscInitStruct.PLL.PLLN = 360; + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; + RCC_OscInitStruct.PLL.PLLQ = 7; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + HAL_RCC_OscConfig( &RCC_OscInitStruct ); // HAL_PWREx_ActivateOverDrive(); -HAL_PWREx_DeactivateOverDrive(); - /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 - clocks dividers */ - RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2); - RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; - RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; - RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; - RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; - HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_8);//FLASH_LATENCY_5); + HAL_PWREx_DeactivateOverDrive(); + + /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */ + RCC_ClkInitTypeDef RCC_ClkInitStruct = { 0 }; + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK + | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; + HAL_RCC_ClockConfig( &RCC_ClkInitStruct, FLASH_LATENCY_8 ); //FLASH_LATENCY_5); - /*##-2- LTDC Clock Configuration ###########################################*/ - /* LCD clock configuration */ - /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */ - /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 192 Mhz */ - /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 192/4 = 48 Mhz */ - /* LTDC clock frequency = PLLLCDCLK / RCC_PLLSAIDIVR_8 = 48/8 = 6 Mhz */ + /*##-2- LTDC Clock Configuration ###########################################*/ + /* LCD clock configuration */ + /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */ + /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 192 Mhz */ + /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 192/4 = 48 Mhz */ + /* LTDC clock frequency = PLLLCDCLK / RCC_PLLSAIDIVR_8 = 48/8 = 6 Mhz */ - /* neu: 8MHz/8*300/5/8 = 7,5 MHz = 19,5 Hz bei 800 x 480 */ - PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC; - PeriphClkInitStruct.PLLSAI.PLLSAIN = 300;//192; - PeriphClkInitStruct.PLLSAI.PLLSAIR = 5;//4; - PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_8;//RCC_PLLSAIDIVR_4;// RCC_PLLSAIDIVR_2; // RCC_PLLSAIDIVR_8 - HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct); + /* neu: 8MHz/8*300/5/8 = 7,5 MHz = 19,5 Hz bei 800 x 480 */ + RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; + PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC; + PeriphClkInitStruct.PLLSAI.PLLSAIN = 300; //192; + PeriphClkInitStruct.PLLSAI.PLLSAIR = 5; //4; + PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_8;//RCC_PLLSAIDIVR_4;// RCC_PLLSAIDIVR_2; // RCC_PLLSAIDIVR_8 + HAL_RCCEx_PeriphCLKConfig( &PeriphClkInitStruct ); } @@ -1503,7 +1532,7 @@ WwdgHandle.Init.Counter = 127; HAL_WWDG_Init(&WwdgHandle); - HAL_WWDG_Start(&WwdgHandle); +/* HAL_WWDG_Start(&WwdgHandle); has been removed from HAL library starting_V120 */ while(1); } diff -r db92692c014f -r 4e10a3e087a1 Common/Drivers/STM32F4xx/Include/system_stm32f4xx.h --- a/Common/Drivers/STM32F4xx/Include/system_stm32f4xx.h Mon Aug 12 15:14:19 2024 +0200 +++ b/Common/Drivers/STM32F4xx/Include/system_stm32f4xx.h Mon Aug 12 22:23:03 2024 +0200 @@ -73,7 +73,6 @@ */ extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ -extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */ extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */ /** diff -r db92692c014f -r 4e10a3e087a1 Common/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_rcc.h --- a/Common/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_rcc.h Mon Aug 12 15:14:19 2024 +0200 +++ b/Common/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_rcc.h Mon Aug 12 22:23:03 2024 +0200 @@ -44,6 +44,9 @@ /* Includes ------------------------------------------------------------------*/ #include "stm32f4xx.h" + +extern __IO const uint8_t AHBPrescTable[16]; + /** @addtogroup STM32F4xx_LL_Driver * @{ */ diff -r db92692c014f -r 4e10a3e087a1 Common/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c --- a/Common/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c Mon Aug 12 15:14:19 2024 +0200 +++ b/Common/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c Mon Aug 12 22:23:03 2024 +0200 @@ -93,6 +93,8 @@ * @{ */ + +extern __IO const uint8_t AHBPrescTable[16]; #ifdef HAL_RCC_MODULE_ENABLED /* Private typedef -----------------------------------------------------------*/ diff -r db92692c014f -r 4e10a3e087a1 OtherSources/system_stm32f4xx.c --- a/OtherSources/system_stm32f4xx.c Mon Aug 12 15:14:19 2024 +0200 +++ b/OtherSources/system_stm32f4xx.c Mon Aug 12 22:23:03 2024 +0200 @@ -74,6 +74,8 @@ #define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/ #endif /* HSI_VALUE */ + +const uint8_t APBPrescTable[8] = {0, 0, 0, 0, 1, 2, 3, 4}; /** * @} */