Skip to content

Commit 3b00724

Browse files
committed
fix iar build
1 parent e2dbf2b commit 3b00724

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

examples/device/mtp/src/mtp_fs_example.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ static fs_file_t fs_objects[FS_MAX_FILE_COUNT] = {
111111
.image_bit_depth = 0,
112112
.parent = 0,
113113
.association_type = MTP_ASSOCIATION_UNDEFINED,
114+
.size = sizeof(README_TXT_CONTENT)-1,
114115
.data = (uint8_t*) (uintptr_t) README_TXT_CONTENT,
115-
.size = sizeof(README_TXT_CONTENT)-1
116116
},
117117
{
118118
.name = { 't', 'i', 'n', 'y', 'u', 's', 'b', '.', 'p', 'n', 'g', 0 }, // "tinyusb.png"
@@ -123,8 +123,8 @@ static fs_file_t fs_objects[FS_MAX_FILE_COUNT] = {
123123
.image_bit_depth = 32,
124124
.parent = 0,
125125
.association_type = MTP_ASSOCIATION_UNDEFINED,
126-
.data = (uint8_t*) (uintptr_t) logo_bin,
127-
.size = logo_len,
126+
.size = LOGO_LEN,
127+
.data = (uint8_t*) (uintptr_t) logo_bin
128128
}
129129
};
130130

@@ -391,7 +391,7 @@ static int32_t fs_get_storage_info(tud_mtp_cb_data_t* cb_data) {
391391
const uint32_t storage_id = command->params[0];
392392
TU_VERIFY(SUPPORTED_STORAGE_ID == storage_id, -1);
393393
// update storage info with current free space
394-
storage_info.max_capacity_in_bytes = sizeof(README_TXT_CONTENT) + logo_len + FS_MAX_CAPACITY_BYTES;
394+
storage_info.max_capacity_in_bytes = sizeof(README_TXT_CONTENT) + LOGO_LEN + FS_MAX_CAPACITY_BYTES;
395395
storage_info.free_space_in_objects = FS_MAX_FILE_COUNT - fs_get_file_count();
396396
storage_info.free_space_in_bytes = storage_info.free_space_in_objects ? FS_MAX_CAPACITY_BYTES : 0;
397397
mtp_container_add_raw(io_container, &storage_info, sizeof(storage_info));

examples/device/mtp/src/tinyusb_logo_png.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// convert using tools/file2carray.py
2-
const size_t logo_len = 2733;
3-
const uint8_t logo_bin[] __attribute__((aligned(16))) = {
2+
enum { LOGO_LEN = 2733 };
3+
static const uint8_t logo_bin[] __attribute__((aligned(16))) = {
44
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
55
0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x40, 0x08, 0x06, 0x00, 0x00, 0x00, 0xd2, 0xd6, 0x7f,
66
0x7f, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0,

tools/file2carray.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ def main():
3535
fout_name = fin_name + '.h'
3636
with open(fout_name, 'w') as fout:
3737
print(f"Converting {fin_name} to {fout_name}")
38-
fout.write(f'const size_t bindata_len = {len(contents)};\n')
38+
fout.write(f'enum {{ BINDATA_LEN = {len(contents)} }};\n')
39+
fout.write(f'const size_t bindata_len = BINDATA_LEN;\n')
3940
fout.write(f'const uint8_t bindata[] __attribute__((aligned(16))) = {{')
4041
print_carray(fout, contents)
4142
fout.write('};\n')

0 commit comments

Comments
 (0)