Skip to content

Commit 8d16679

Browse files
microbit-carlosmathias-arm
authored andcommitted
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 b54840f commit 8d16679

File tree

4 files changed

+38
-90
lines changed

4 files changed

+38
-90
lines changed

source/daplink/bootloader/daplink.c

Lines changed: 0 additions & 41 deletions
This file was deleted.

source/daplink/daplink.h

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,46 @@ COMPILER_ASSERT(DAPLINK_RAM_SHARED_START + DAPLINK_RAM_SHARED_SIZE == DAPLINK_RA
8181
// Macro with the name of the main application header file.
8282
#if defined(DAPLINK_BL)
8383
#define DAPLINK_MAIN_HEADER "main_bootloader.h"
84+
85+
#include "virtual_fs.h"
86+
87+
COMPILER_ASSERT(DAPLINK_BUILD_KEY == DAPLINK_BUILD_KEY_BL);
88+
89+
// daplink_mode_file_name, daplink_url_name and
90+
// daplink_drive_name strings must be 11 characters
91+
// excluding the null terminated character
92+
static const char daplink_mode_file_name[11] = "START_IFACT";
93+
94+
__STATIC_FORCEINLINE bool daplink_is_bootloader()
95+
{
96+
return true;
97+
}
98+
99+
__STATIC_FORCEINLINE bool daplink_is_interface()
100+
{
101+
return false;
102+
}
103+
84104
#elif defined(DAPLINK_IF)
85105
#define DAPLINK_MAIN_HEADER "main_interface.h"
106+
107+
#if defined(DRAG_N_DROP_SUPPORT) && !defined(DRAG_N_DROP_DISABLE)
108+
#include "virtual_fs.h"
109+
COMPILER_ASSERT(DAPLINK_BUILD_KEY == DAPLINK_BUILD_KEY_IF);
110+
111+
static const vfs_filename_t daplink_mode_file_name = "START_BLACT";
112+
#endif //DRAG_N_DROP_SUPPORT
113+
114+
__STATIC_FORCEINLINE bool daplink_is_bootloader()
115+
{
116+
return false;
117+
}
118+
119+
__STATIC_FORCEINLINE bool daplink_is_interface()
120+
{
121+
return true;
122+
}
123+
86124
#else
87125
#error "Neither DAPLINK_BL nor DAPLINK_IF are defined!"
88126
#endif
@@ -93,9 +131,6 @@ typedef struct {
93131
uint32_t version;
94132
} daplink_info_t;
95133

96-
bool daplink_is_bootloader(void);
97-
bool daplink_is_interface(void);
98-
99134
#ifdef __cplusplus
100135
}
101136
#endif

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

Lines changed: 0 additions & 3 deletions
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

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)