|
9 | 9 | #include "bootloader_settings.h"
|
10 | 10 | #include "bootloader.h"
|
11 | 11 |
|
| 12 | +// Uncomment the next line to create an additional 20 files in root. |
12 | 13 | // #define CREATE_MANY_FILES
|
13 | 14 |
|
14 |
| - |
15 | 15 | typedef struct {
|
16 | 16 | uint8_t JumpInstruction[3];
|
17 | 17 | uint8_t OEMInfo[8];
|
@@ -67,7 +67,8 @@ const char infoUf2File[] = //
|
67 | 67 | "Model: " PRODUCT_NAME "\r\n"
|
68 | 68 | "Board-ID: " BOARD_ID "\r\n"
|
69 | 69 | "Bootloader: " BOOTLOADER_ID "\r\n"
|
70 |
| - "Date: " __DATE__ "\r\n"; |
| 70 | + "Date: " __DATE__ "\r\n" |
| 71 | + "Time: " __TIME__ "\r\n"; |
71 | 72 |
|
72 | 73 | const char indexFile[] = //
|
73 | 74 | "<!doctype html>\n"
|
@@ -276,22 +277,31 @@ void read_block(uint32_t block_no, uint8_t *data) {
|
276 | 277 | // volume label is first directory entry
|
277 | 278 | padded_memcpy(d->name, (char const *) BootBlock.VolumeLabel, 11);
|
278 | 279 | d->attrs = 0x28;
|
| 280 | + d++; |
279 | 281 | remainingEntries--;
|
280 | 282 | }
|
281 | 283 |
|
282 | 284 | for (int i = DIRENTRIES_PER_SECTOR * sectionIdx;
|
283 | 285 | remainingEntries > 0 && i < NUM_FILES;
|
284 | 286 | i++, d++) {
|
| 287 | + |
| 288 | + // WARNING -- code presumes all but last file take exactly one sector |
| 289 | + uint16_t startCluster = i + 2; |
| 290 | + |
285 | 291 | struct TextFile const * inf = &info[i];
|
| 292 | + padded_memcpy(d->name, inf->name, 11); |
| 293 | + d->createTimeFine = __SECONDS_INT__ % 2 * 100; |
| 294 | + d->createTime = __DOSTIME__; |
| 295 | + d->createDate = __DOSDATE__; |
| 296 | + d->lastAccessDate = __DOSDATE__; |
| 297 | + d->highStartCluster = startCluster >> 8; |
| 298 | + // DIR_WrtTime and DIR_WrtDate must be supported |
| 299 | + d->updateTime = __DOSTIME__; |
| 300 | + d->updateDate = __DOSDATE__; |
| 301 | + d->startCluster = startCluster & 0xFF; |
286 | 302 | // WARNING -- code presumes only one NULL .content for .UF2 file
|
287 | 303 | // and requires it be the last element of the array
|
288 | 304 | d->size = inf->content ? strlen(inf->content) : UF2_SIZE;
|
289 |
| - d->startCluster = i + 2; |
290 |
| - padded_memcpy(d->name, inf->name, 11); |
291 |
| - // DIR_WrtTime and DIR_WrtDate must be supported |
292 |
| - d->updateDate = __DOSDATE__; |
293 |
| - d->lastAccessDate = __DOSDATE__; |
294 |
| - d->createDate = __DOSDATE__; |
295 | 305 | }
|
296 | 306 |
|
297 | 307 | } else {
|
|
0 commit comments