@@ -99,7 +99,7 @@ STATIC_ASSERT(ARRAY_SIZE(indexFile) < 512);
99
99
#define NUM_FILES (ARRAY_SIZE(info))
100
100
#define NUM_DIRENTRIES (NUM_FILES + 1) // Code adds volume label as first root directory entry
101
101
102
- #define UF2_SIZE (uf2current_flash_sz * 2)
102
+ #define UF2_SIZE ((USER_FLASH_END-USER_FLASH_START) * 2)
103
103
#define UF2_SECTORS (UF2_SIZE / 512)
104
104
#define UF2_FIRST_SECTOR (NUM_FILES + 1) // WARNING -- code presumes each non-UF2 file content fits in single sector
105
105
#define UF2_LAST_SECTOR (UF2_FIRST_SECTOR + UF2_SECTORS - 1)
@@ -169,31 +169,10 @@ static inline bool in_uicr_space(uint32_t addr)
169
169
//--------------------------------------------------------------------+
170
170
//
171
171
//--------------------------------------------------------------------+
172
- static uint32_t uf2current_flash_sz = 0 ;
173
-
174
-
175
- // get current.uf2 flash size in bytes, round up to 256 bytes
176
- static uint32_t current_flash_size (void )
177
- {
178
- uint32_t flash_sz = 0 ;
179
-
180
- // return 1 block of 256 bytes
181
- if ( !bootloader_app_is_valid () )
182
- {
183
- flash_sz = 256 ;
184
- }else
185
- {
186
- // Use full application size for simplicity
187
- flash_sz = (USER_FLASH_END - USER_FLASH_START );
188
- }
189
-
190
- return flash_sz ;
191
- }
192
172
193
173
void uf2_init (void )
194
174
{
195
- uf2current_flash_sz = current_flash_size ();
196
- PRINT_INT (uf2current_flash_sz );
175
+ // nothing to do
197
176
}
198
177
199
178
/*------------------------------------------------------------------*/
@@ -289,7 +268,7 @@ void read_block(uint32_t block_no, uint8_t *data) {
289
268
bl -> magicStart1 = UF2_MAGIC_START1 ;
290
269
bl -> magicEnd = UF2_MAGIC_END ;
291
270
bl -> blockNo = sectionIdx ;
292
- bl -> numBlocks = uf2current_flash_sz / 256 ;
271
+ bl -> numBlocks = ( UF2_SIZE / 2 ) / 256 ;
293
272
bl -> targetAddr = addr ;
294
273
bl -> payloadSize = 256 ;
295
274
bl -> flags = UF2_FLAG_FAMILYID ;
0 commit comments