File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ func main() {
36
36
// Create the new content with the length in front
37
37
len_str := fmt .Sprintf ("%d" , length )
38
38
newContent := append ([]byte (len_str ), 0 , byte (debug ))
39
+ // make newContent 16 bytes
40
+ tmp := make ([]byte , 16 - len (newContent ))
41
+ newContent = append (newContent , tmp ... )
39
42
newContent = append (newContent , content ... )
40
43
41
44
// Write the new content to the new file
Original file line number Diff line number Diff line change @@ -53,15 +53,24 @@ static int loader(const struct shell *sh)
53
53
return 0 ;
54
54
}
55
55
56
- int header_len = endptr - header + 2 ;
56
+ int header_len = 16 ;
57
57
58
+ #if defined(CONFIG_LLEXT_STORAGE_WRITABLE )
58
59
uint8_t * sketch_buf = k_aligned_alloc (4096 , sketch_buf_len );
59
60
61
+ if (!sketch_buf ) {
62
+ printk ("Unable to allocate %d bytes\n" , sketch_buf_len );
63
+ }
64
+
60
65
rc = flash_area_read (fa , header_len , sketch_buf , sketch_buf_len );
61
66
if (rc ) {
62
67
printk ("Failed to read sketch area, rc %d\n" , rc );
63
68
return rc ;
64
69
}
70
+ #else
71
+ uint32_t offset = FIXED_PARTITION_OFFSET (user_sketch );
72
+ uint8_t * sketch_buf = (uint8_t * )(offset + header_len );
73
+ #endif
65
74
66
75
struct llext_buf_loader buf_loader = LLEXT_BUF_LOADER (sketch_buf , sketch_buf_len );
67
76
struct llext_loader * ldr = & buf_loader .loader ;
You can’t perform that action at this time.
0 commit comments