DAPLink

DAPLink

去掉USB的IAP功能,bootloader省掉,APP部分修改宏定义大小,可用stm32f103c8t6

stm32f103xb_stm32f103rb_if 比stm32f103xb_if 多了g_target_family定义
init_family函数直接返回,多了目标配置

1
2
3
4
5
init_family();

if (g_target_family && g_target_family->prerun_target_config) {
g_target_family->prerun_target_config();
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* @file daplink_addr.h
* @brief
*
* DAPLink Interface Firmware
* */
#ifndef DAPLINK_ADDR_H
#define DAPLINK_ADDR_H

/* Device sizes */

#define DAPLINK_ROM_START 0x08000000
#define DAPLINK_ROM_SIZE 0x00010000

#define DAPLINK_RAM_START 0x20000000
#define DAPLINK_RAM_SIZE 0x00005000

/* ROM sizes */

#define DAPLINK_ROM_BL_START 0x08000000
#define DAPLINK_ROM_BL_SIZE 0

#define DAPLINK_ROM_CONFIG_ADMIN_START 0x08000000
#define DAPLINK_ROM_CONFIG_ADMIN_SIZE 0

#define DAPLINK_ROM_IF_START 0x08000000
#define DAPLINK_ROM_IF_SIZE 0x0000FC00

#define DAPLINK_ROM_CONFIG_USER_START 0x0800FC00
#define DAPLINK_ROM_CONFIG_USER_SIZE 0x00000400

/* RAM sizes */

#define DAPLINK_RAM_APP_START 0x20000000
#define DAPLINK_RAM_APP_SIZE 0x00004F00

#define DAPLINK_RAM_SHARED_START 0x20004F00
#define DAPLINK_RAM_SHARED_SIZE 0x00000100

/* Flash Programming Info */

#define DAPLINK_SECTOR_SIZE 0x00000400
#define DAPLINK_MIN_WRITE_SIZE 0x00000400

/* Current build */

#if defined(DAPLINK_BL)

#define DAPLINK_ROM_APP_START DAPLINK_ROM_BL_START
#define DAPLINK_ROM_APP_SIZE DAPLINK_ROM_BL_SIZE
#define DAPLINK_ROM_UPDATE_START DAPLINK_ROM_IF_START
#define DAPLINK_ROM_UPDATE_SIZE DAPLINK_ROM_IF_SIZE

#elif defined(DAPLINK_IF)

#define DAPLINK_ROM_APP_START DAPLINK_ROM_IF_START
#define DAPLINK_ROM_APP_SIZE DAPLINK_ROM_IF_SIZE
#define DAPLINK_ROM_UPDATE_START DAPLINK_ROM_BL_START
#define DAPLINK_ROM_UPDATE_SIZE DAPLINK_ROM_BL_SIZE

#else

#error "Build must be either bootloader or interface"

#endif

#endif

IO_Config.h修改配置更改IO口,uart.c修改CDC串口。可引出boot0,CDC改用串口1,使用ISP烧录,增加nReset按键,增加各外设LED指示

可以在vfs_user.c加入使用信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
static uint32_t update_details_txt_file(uint8_t *buf, uint32_t size, uint32_t start)
{
uint32_t pos = 0;

pos += util_write_string_in_region(buf, size, start, pos,
"Author: guoxin\r\n\r\n"
// Build ID
"Build ID: (" COMPILER_DESCRIPTION LOCAL_MODS ")\r\n");
// Unique ID
pos += expand_string_in_region(buf, size, start, pos, "Unique ID: @U\r\n");
// HIC ID
pos += expand_string_in_region(buf, size, start, pos, "HIC ID: @D\r\n");
// Settings
pos += setting_in_region(buf, size, start, pos, "Auto Reset", config_get_auto_rst());
pos += setting_in_region(buf, size, start, pos, "Automation allowed", config_get_automation_allowed());
pos += setting_in_region(buf, size, start, pos, "Overflow detection", config_get_overflow_detect());
pos += setting_in_region(buf, size, start, pos, "Incompatible image detection", config_get_detect_incompatible_target());
pos += setting_in_region(buf, size, start, pos, "Page erasing", config_ram_get_page_erase());

// Current mode and version
#if defined(DAPLINK_BL)
pos += util_write_string_in_region(buf, size, start, pos, "Daplink Mode: Bootloader\r\n");
pos += expand_string_in_region(buf, size, start, pos, "Bootloader Version: @V\r\n");

if (info_get_interface_present()) {
char version[6] = { 0, 0, 0, 0, '\r', '\n' };
pos += util_write_string_in_region(buf, size, start, pos, "Interface Version: ");
util_write_uint32_zp(version, info_get_interface_version(), 4);
pos += util_write_in_region(buf, size, start, pos, version, 6);
}
#elif defined(DAPLINK_IF)
pos += util_write_string_in_region(buf, size, start, pos, "Daplink Mode: Interface\r\n");
pos += expand_string_in_region(buf, size, start, pos, "Interface Version: @V\r\n");

#if DAPLINK_ROM_BL_SIZE != 0
if (info_get_bootloader_present()) {
char version[6] = { 0, 0, 0, 0, '\r', '\n' };
pos += util_write_string_in_region(buf, size, start, pos, "Bootloader Version: ");
util_write_uint32_zp(version, info_get_bootloader_version(), 4);
pos += util_write_in_region(buf, size, start, pos, version, 6);
}
#endif
#endif

pos += util_write_string_in_region(buf, size, start, pos,
// Local modifications when making the build
#if GIT_LOCAL_MODS
"Local Mods: 1\r\n"
#else
"Local Mods: 0\r\n"
#endif
// Supported USB endpoints
"USB Interfaces: "
#ifdef MSC_ENDPOINT
"MSD"
#endif
#ifdef CDC_ENDPOINT
", CDC"
#endif
#ifdef HID_ENDPOINT
", HID"
#endif
#if (WEBUSB_INTERFACE)
", WebUSB"
#endif
"\r\n");

#if DAPLINK_ROM_BL_SIZE != 0
// CRC of the bootloader (if there is one)
if (info_get_bootloader_present()) {
pos += hex32_field_in_region(buf, size, start, pos, "Bootloader CRC", info_get_crc_bootloader());
}
#endif

// CRC of the interface
pos += hex32_field_in_region(buf, size, start, pos, "Interface CRC", info_get_crc_interface());

// Number of remounts that have occurred
pos += uint32_field_in_region(buf, size, start, pos, "Remount count", remount_count);

//Target URL
pos += expand_string_in_region(buf, size, start, pos, "target mcu: stm32f103rb\r\n");

pos += expand_string_in_region(buf, size, start, pos, "\r\nUSART->TX:A2 RX:A3\r\nSWD->CLK:B13 DIO:B14 (DIO_IN:A12)\r\nJTAG->TDI:A7 TDO:A5\r\nLED:A9");

return pos;
}
1
2
//修改虚拟硬盘文件
void vfs_user_build_filesystem()
1
2
//修改磁盘名称
static inline const char * get_daplink_drive_name ( void )
-->

请我喝杯咖啡吧~

支付宝
微信