Skip to content

Commit 9762c87

Browse files
committed
Cleanup includes in board.h and fix dfu an main build accordingly
1 parent 6a124de commit 9762c87

File tree

4 files changed

+13
-18
lines changed

4 files changed

+13
-18
lines changed

app/board.h

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,7 @@
1919
#ifndef __TARGET_INIT_H
2020
#define __TARGET_INIT_H
2121

22-
#include "stm32h7xx_hal.h"
23-
#include "stm32h7xx_hal_mdma.h"
24-
#include "stm32h7xx_hal_qspi.h"
25-
#if MCUBOOT_APPLICATION_DFU
26-
#include "usbd_core.h"
27-
#include "usbd_desc.h"
28-
#include "usbd_dfu.h"
29-
#include "usbd_dfu_flash.h"
30-
#endif
31-
32-
#if MCUBOOT_APPLICATION_DFU
33-
#define APP_DEFAULT_ADD USBD_DFU_APP_DEFAULT_ADD
34-
#else
35-
#define APP_DEFAULT_ADD 0x08040000
36-
#endif
22+
#define BOARD_APP_DEFAULT_ADD 0x08040000
3723

3824
#define BOOTLOADER_CONFIG_MAGIC 0xA0
3925
#define BOOTLOADER_VERSION 4

app/dfu/usbd_conf.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
/* Includes ------------------------------------------------------------------ */
2323
#include "board.h"
24+
#include "usbd_core.h"
25+
#include "usbd_desc.h"
26+
#include "usbd_conf.h"
2427

2528
/* Private typedef ----------------------------------------------------------- */
2629
/* Private define ------------------------------------------------------------ */

app/dfu/usbd_conf.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#define __USBD_CONF_H
2323

2424
/* Includes ------------------------------------------------------------------*/
25+
#include "board.h"
2526
#include "stm32h7xx_hal.h"
2627
#include <stdio.h>
2728
#include <stdlib.h>
@@ -40,7 +41,7 @@
4041
/* DFU Class Config */
4142
#define USBD_DFU_MAX_ITF_NUM 4
4243
#define USBD_DFU_XFER_SIZE 4096 /* Max DFU Packet Size = 4096 bytes */
43-
#define USBD_DFU_APP_DEFAULT_ADD 0x08040000 /* The first sector (32 KB) is reserved for DFU code */
44+
#define USBD_DFU_APP_DEFAULT_ADD BOARD_APP_DEFAULT_ADD /* The first sector (32 KB) is reserved for DFU code */
4445
#define USBD_DFU_MAX_NB_OF_SECTORS 16 /* Max number of sectors */
4546

4647
#define CDC_CLASS_DESC_SIZE (8 + 58)

app/main.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
#include "bootutil/image.h"
3030
#include "mbedtls/platform.h"
3131

32+
#if MCUBOOT_APPLICATION_DFU
33+
#include "usbd_desc.h"
34+
#include "usbd_dfu_flash.h"
35+
#endif
36+
3237
// clock source is selected with CLOCK_SOURCE in json config
3338
#define USE_PLL_HSE_EXTC 0x8 // Use external clock (ST Link MCO)
3439
#define USE_PLL_HSE_XTAL 0x4 // Use external xtal (X3 on board - not provided by default)
@@ -268,9 +273,9 @@ int main(void) {
268273

269274
if (valid_application()) {
270275
/* Boot Sketch */
271-
BOOT_LOG_INF("Booting sketch at 0x%x\n", APP_DEFAULT_ADD);
276+
BOOT_LOG_INF("Booting sketch at 0x%x\n", BOARD_APP_DEFAULT_ADD);
272277
RTCSetBKPRegister(RTC_BKP_DR0, 0);
273-
mbed_start_application(APP_DEFAULT_ADD);
278+
mbed_start_application(BOARD_APP_DEFAULT_ADD);
274279
} else {
275280
BOOT_LOG_INF("No sketch found");
276281
}

0 commit comments

Comments
 (0)