Skip to content

Commit 106fa09

Browse files
Move the daplink.c contents into header file & force inline.
This frees up about 168 bytes with 10.3.1, which is needed to fit more features in some bootladers that were alredy at the .text limit.
1 parent 9537756 commit 106fa09

File tree

4 files changed

+38
-90
lines changed

4 files changed

+38
-90
lines changed

source/daplink/bootloader/daplink.c

-41
This file was deleted.

source/daplink/daplink.h

+38-3
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,46 @@ COMPILER_ASSERT(DAPLINK_RAM_SHARED_START + DAPLINK_RAM_SHARED_SIZE == DAPLINK_RA
7575
// Macro with the name of the main application header file.
7676
#if defined(DAPLINK_BL)
7777
#define DAPLINK_MAIN_HEADER "main_bootloader.h"
78+
79+
#include "virtual_fs.h"
80+
81+
COMPILER_ASSERT(DAPLINK_BUILD_KEY == DAPLINK_BUILD_KEY_BL);
82+
83+
// daplink_mode_file_name, daplink_url_name and
84+
// daplink_drive_name strings must be 11 characters
85+
// excluding the null terminated character
86+
static const char daplink_mode_file_name[11] = "START_IFACT";
87+
88+
__STATIC_FORCEINLINE bool daplink_is_bootloader()
89+
{
90+
return true;
91+
}
92+
93+
__STATIC_FORCEINLINE bool daplink_is_interface()
94+
{
95+
return false;
96+
}
97+
7898
#elif defined(DAPLINK_IF)
7999
#define DAPLINK_MAIN_HEADER "main_interface.h"
100+
101+
#ifdef DRAG_N_DROP_SUPPORT
102+
#include "virtual_fs.h"
103+
COMPILER_ASSERT(DAPLINK_BUILD_KEY == DAPLINK_BUILD_KEY_IF);
104+
105+
static const vfs_filename_t daplink_mode_file_name = "START_BLACT";
106+
#endif //DRAG_N_DROP_SUPPORT
107+
108+
__STATIC_FORCEINLINE bool daplink_is_bootloader()
109+
{
110+
return false;
111+
}
112+
113+
__STATIC_FORCEINLINE bool daplink_is_interface()
114+
{
115+
return true;
116+
}
117+
80118
#else
81119
#error "Neither DAPLINK_BL nor DAPLINK_IF are defined!"
82120
#endif
@@ -87,9 +125,6 @@ typedef struct {
87125
uint32_t version;
88126
} daplink_info_t;
89127

90-
bool daplink_is_bootloader(void);
91-
bool daplink_is_interface(void);
92-
93128
#ifdef __cplusplus
94129
}
95130
#endif

source/daplink/drag-n-drop/vfs_manager.h

-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@
3232
extern "C" {
3333
#endif
3434

35-
36-
extern const vfs_filename_t daplink_mode_file_name;
37-
3835
/* Callable from anywhere */
3936

4037
// Enable or disable the virtual filesystem

source/daplink/interface/daplink.c

-43
This file was deleted.

0 commit comments

Comments
 (0)