Skip to content

Add support for native lib loading on VESC Express targets - #107

Merged
vedderb merged 3 commits into
vedderb:mainfrom
techfoundrynz:feat/express-native-lib
Jul 16, 2026
Merged

Add support for native lib loading on VESC Express targets#107
vedderb merged 3 commits into
vedderb:mainfrom
techfoundrynz:feat/express-native-lib

Conversation

@techfoundrynz

@techfoundrynz techfoundrynz commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Add native lib load support to ESP32 targets

This change introduces native lib loading for package feature parity with the standard stm32 firmware. It builds on the work of #69 but adds support for all currently supported esp32 family chips across both the Xtensa and RISC-V architectures.

The native binaries are built with the ESP-IDF GCC toolchains (riscv32-esp-elf/xtensa-esp32s3-elf), one binary per chip.

For the RISC-V targets (C3/C6/P4), the binary is compiled position-independent and load-native-lib executes it in place from the memory-mapped lisp partition.

Xtensa (S3) doesn't support PIC, so the binary is linked at address 0 and copied into RAM at load time. load-native-lib patches the absolute addresses using a fixup table generated from the ELF relocations at build time.

In both cases the lib finds the firmware interface table at a fixed address (similar to bldc's table at 0x1000F800).

Packaging support is provided by the following change to the vesc_pkg repo:
vedderb/vesc_pkg#99

As per @vedderb's request, the firmware interface file has been split.

@techfoundrynz

techfoundrynz commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Currently untested on ESP32-P4 but all other targets are confirmed working with the example package from my vesc_pkg PR.

image image image

@DovPearX maybe you could assist in testing that variant?

@techfoundrynz
techfoundrynz marked this pull request as ready for review July 15, 2026 08:21
@techfoundrynz

Copy link
Copy Markdown
Contributor Author

Confirmed working on P4
image

@vedderb

vedderb commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Nice work!

Can you just move vesc_c_if out of the lispBM-folder? I'm trying to keep it identical to the lispBM repo. Then I will merge and test it.

@techfoundrynz

Copy link
Copy Markdown
Contributor Author

Nice work!

Can you just move vesc_c_if out of the lispBM-folder? I'm trying to keep it identical to the lispBM repo. Then I will merge and test it.

Sure thing, on it now!

@techfoundrynz

Copy link
Copy Markdown
Contributor Author

Nice work!

Can you just move vesc_c_if out of the lispBM-folder? I'm trying to keep it identical to the lispBM repo. Then I will merge and test it.

Done! Mirrored the pattern from bldc

@vedderb
vedderb merged commit ed2d900 into vedderb:main Jul 16, 2026
@vedderb

vedderb commented Jul 16, 2026

Copy link
Copy Markdown
Owner

I gave it a try and it seems to work, very nice work!

@techfoundrynz

Copy link
Copy Markdown
Contributor Author

I gave it a try and it seems to work, very nice work!

Thanks again for the awesome project that keeps on giving!

@vedderb

vedderb commented Jul 16, 2026

Copy link
Copy Markdown
Owner

6169523

Can you check if this commit broke anything? It works for me on the C3. It also allows putting the native library code directly in the source if it is in a const block

@const-start

(def lib [
    0xca 0xfe 0xba 0xbe 0x00 0x00 0x00 0x00 0x01 0x11 0x22 0xcc 0x37 0xc4 0xcd 0x3f 0x13 0x04 0x04 0xe0
    0x97 0x07 0x00 0x00 0x83 0xa7 0x07 0xff 0x4a 0xc8 0x03 0x29 0x04 0x00 0x06 0xce 0x26 0xca 0x4e 0xc6
    0x85 0x47 0x63 0x10 0xf9 0x04 0x83 0x27 0x44 0x10 0xaa 0x89 0x21 0x45 0x82 0x97 0xaa 0x84 0x05 0xc9
    0x83 0x27 0xc4 0x10 0x85 0x65 0x23 0x22 0x05 0x00 0xaa 0x86 0x17 0x06 0x00 0x00 0x13 0x06 0x06 0x2e
    0x93 0x85 0x05 0x80 0x17 0x05 0x00 0x00 0x13 0x05 0x85 0x08 0x82 0x97 0x88 0xc0 0x09 0xed 0x83 0x27
    0x84 0x10 0x26 0x85 0x82 0x97 0x01 0x45 0xf2 0x40 0x62 0x44 0xd2 0x44 0x42 0x49 0xb2 0x49 0x05 0x61
    0x82 0x80 0x5c 0x40 0x97 0x05 0x00 0x00 0x93 0x85 0x65 0x09 0x17 0x05 0x00 0x00 0x13 0x05 0x05 0x2b
    0x82 0x97 0x5c 0x40 0x97 0x05 0x00 0x00 0x93 0x85 0x65 0x0a 0x17 0x05 0x00 0x00 0x13 0x05 0xc5 0x2a
    0x82 0x97 0x5c 0x40 0x97 0x05 0x00 0x00 0x93 0x85 0x05 0x14 0x17 0x05 0x00 0x00 0x13 0x05 0x85 0x2a
    0x82 0x97 0x97 0x07 0x00 0x00 0x93 0x87 0x47 0x0f 0x23 0xa2 0x99 0x00 0x23 0xa0 0xf9 0x00 0xb7 0xc7
    0xcd 0x3f 0x83 0xa7 0x07 0xf0 0x17 0x05 0x00 0x00 0x13 0x05 0xa5 0x29 0x82 0x97 0x4a 0x85 0x49 0xbf
    0x41 0x11 0x22 0xc4 0x37 0xc4 0xcd 0x3f 0x26 0xc2 0x06 0xc6 0xaa 0x84 0x13 0x04 0x04 0xe0 0x83 0x27
    0x44 0x11 0x82 0x97 0x11 0xc5 0xb2 0x40 0x22 0x44 0x92 0x44 0x41 0x01 0x82 0x80 0xdc 0x40 0x13 0x05
    0x40 0x06 0x85 0x07 0xdc 0xc0 0x83 0x27 0xc4 0x0d 0x82 0x97 0xf9 0xbf 0x41 0x11 0x22 0xc4 0x37 0xc4
    0xcd 0x3f 0x83 0x27 0x04 0xf0 0x06 0xc6 0x17 0x05 0x00 0x00 0x13 0x05 0x45 0x1b 0x82 0x97 0x03 0x25
    0xc4 0xe9 0xb2 0x40 0x22 0x44 0x41 0x01 0x82 0x80 0x89 0x47 0x63 0x94 0xf5 0x06 0x41 0x11 0x22 0xc4
    0x37 0xc4 0xcd 0x3f 0x26 0xc2 0x83 0x27 0x44 0xe8 0xaa 0x84 0x08 0x41 0x06 0xc6 0x4a 0xc0 0x13 0x04
    0x04 0xe0 0x82 0x97 0x15 0xc9 0x83 0x27 0x44 0x08 0xc8 0x40 0x82 0x97 0x0d 0xc5 0x7c 0x50 0x88 0x40
    0x82 0x97 0x7c 0x50 0x2a 0x89 0xc8 0x40 0x82 0x97 0xaa 0x85 0x4a 0x85 0x97 0x00 0x00 0x00 0xe7 0x80
    0x20 0x0b 0x7c 0x48 0x22 0x44 0xb2 0x40 0x92 0x44 0x02 0x49 0x41 0x01 0x82 0x87 0xb2 0x40 0x22 0x44
    0xb7 0xc7 0xcd 0x3f 0x03 0xa5 0x07 0xea 0x92 0x44 0x02 0x49 0x41 0x01 0x82 0x80 0xb7 0xc7 0xcd 0x3f
    0x03 0xa5 0x07 0xea 0x82 0x80 0x05 0xcd 0x41 0x11 0x26 0xc2 0xb7 0xc4 0xcd 0x3f 0x22 0xc4 0x83 0xa7
    0x04 0xf1 0x2a 0x84 0x08 0x41 0x06 0xc6 0x82 0x97 0x83 0xa7 0x04 0xf0 0x4c 0x40 0x17 0x05 0x00 0x00
    0x13 0x05 0xc5 0x12 0x82 0x97 0x22 0x85 0x22 0x44 0x83 0xa7 0x84 0xf0 0xb2 0x40 0x92 0x44 0x41 0x01
    0x82 0x87 0x82 0x80 0x41 0x11 0x22 0xc4 0x37 0xc4 0xcd 0x3f 0x83 0x27 0xc4 0xf1 0x06 0xc6 0x17 0x05
    0x00 0x00 0x13 0x05 0x25 0xe1 0x82 0x97 0x1c 0x41 0x13 0x04 0x04 0xe0 0x99 0xc7 0x38 0x44 0x22 0x44
    0xb2 0x40 0xc8 0x43 0x41 0x01 0x02 0x87 0x1c 0x44 0x17 0x05 0x00 0x00 0x13 0x05 0x65 0x10 0x82 0x97
    0x03 0x25 0x44 0x0a 0xb2 0x40 0x22 0x44 0x41 0x01 0x82 0x80 0x37 0x07 0x00 0x80 0xb3 0x47 0xb5 0x00
    0x7d 0x8f 0x93 0x07 0xf0 0x0f 0x13 0x56 0x75 0x01 0x7d 0x8e 0x93 0xd6 0x75 0x01 0xfd 0x8e 0x63 0x05
    0xf6 0x06 0x63 0x83 0xf6 0x06 0x39 0xce 0xb1 0xce 0x36 0x96 0x26 0x05 0xa6 0x05 0xb7 0x06 0x00 0x08
    0x15 0x81 0x95 0x81 0x55 0x8d 0xd5 0x8d 0xb3 0x06 0xb5 0x02 0xb3 0x35 0xb5 0x02 0x3a 0x85 0xb7 0x07
    0x80 0x00 0x63 0xf8 0xf5 0x00 0x86 0x05 0x93 0xd7 0xf6 0x01 0xdd 0x8d 0x86 0x06 0x7d 0x16 0x4d 0x8d
    0x13 0x06 0x16 0xf8 0x93 0x07 0xe0 0x0f 0x63 0x7d 0xf6 0x00 0x37 0x07 0x00 0x80 0x5e 0x06 0x32 0x95
    0x63 0xe6 0xe6 0x00 0x05 0x05 0x63 0x93 0xe6 0x00 0x79 0x99 0x82 0x80 0x63 0x42 0xc0 0x02 0x09 0xa0
    0x3a 0x85 0x82 0x80 0x62 0x06 0xe2 0x06 0x19 0xce 0x91 0xce 0xe2 0x07 0x93 0x16 0x15 0x00 0x63 0xea
    0xd7 0x00 0x93 0x96 0x15 0x00 0x63 0xe6 0xd7 0x00 0x37 0x05 0x80 0x7f 0x59 0x8d 0x82 0x80 0x37 0x05
    0xc0 0x7f 0x82 0x80 0x48 0x65 0x6c 0x6c 0x6f 0x20 0x66 0x72 0x6f 0x6d 0x20 0x74 0x68 0x65 0x20 0x6e
    0x61 0x74 0x69 0x76 0x65 0x20 0x74 0x65 0x73 0x74 0x20 0x6c 0x69 0x62 0x21 0x00 0x54 0x65 0x73 0x74
    0x20 0x6c 0x69 0x62 0x20 0x73 0x74 0x6f 0x70 0x70 0x65 0x64 0x2c 0x20 0x63 0x6f 0x75 0x6e 0x74 0x65
    0x72 0x20 0x77 0x61 0x73 0x20 0x25 0x64 0x00 0x00 0x00 0x00 0x4e 0x6f 0x74 0x20 0x69 0x6e 0x69 0x74
    0x69 0x61 0x6c 0x69 0x7a 0x65 0x64 0x00 0x6c 0x69 0x62 0x5f 0x74 0x65 0x73 0x74 0x00 0x00 0x00 0x00
    0x65 0x78 0x74 0x2d 0x74 0x65 0x73 0x74 0x2d 0x68 0x65 0x6c 0x6c 0x6f 0x00 0x00 0x65 0x78 0x74 0x2d
    0x74 0x65 0x73 0x74 0x2d 0x6d 0x75 0x6c 0x00 0x00 0x00 0x00 0x65 0x78 0x74 0x2d 0x74 0x65 0x73 0x74
    0x2d 0x63 0x6f 0x75 0x6e 0x74 0x65 0x72 0x00 0x00 0x00 0x00 0x4e 0x61 0x74 0x69 0x76 0x65 0x20 0x74
    0x65 0x73 0x74 0x20 0x6c 0x69 0x62 0x20 0x6c 0x6f 0x61 0x64 0x65 0x64 0x00
])

(def target (sysinfo 'hw-target))

(if (eq lib nil)
    (print (str-merge "No native test lib for target " target))
{
    (print (str-merge "Loading native test lib for " target))
    (print (load-native-lib lib))
    (ext-test-hello)
    (print (str-merge "2.5 * 3.0 = " (str-from-n (ext-test-mul 2.5 3.0))))
    (sleep 1)
    (print (str-merge "Counter after 1s (expect ~10): " (str-from-n (ext-test-counter))))
})

@techfoundrynz

Copy link
Copy Markdown
Contributor Author

6169523

Can you check if this commit broke anything? It works for me on the C3. It also allows putting the native library code directly in the source if it is in a const block

@const-start

(def lib [
    0xca 0xfe 0xba 0xbe 0x00 0x00 0x00 0x00 0x01 0x11 0x22 0xcc 0x37 0xc4 0xcd 0x3f 0x13 0x04 0x04 0xe0
    0x97 0x07 0x00 0x00 0x83 0xa7 0x07 0xff 0x4a 0xc8 0x03 0x29 0x04 0x00 0x06 0xce 0x26 0xca 0x4e 0xc6
    0x85 0x47 0x63 0x10 0xf9 0x04 0x83 0x27 0x44 0x10 0xaa 0x89 0x21 0x45 0x82 0x97 0xaa 0x84 0x05 0xc9
    0x83 0x27 0xc4 0x10 0x85 0x65 0x23 0x22 0x05 0x00 0xaa 0x86 0x17 0x06 0x00 0x00 0x13 0x06 0x06 0x2e
    0x93 0x85 0x05 0x80 0x17 0x05 0x00 0x00 0x13 0x05 0x85 0x08 0x82 0x97 0x88 0xc0 0x09 0xed 0x83 0x27
    0x84 0x10 0x26 0x85 0x82 0x97 0x01 0x45 0xf2 0x40 0x62 0x44 0xd2 0x44 0x42 0x49 0xb2 0x49 0x05 0x61
    0x82 0x80 0x5c 0x40 0x97 0x05 0x00 0x00 0x93 0x85 0x65 0x09 0x17 0x05 0x00 0x00 0x13 0x05 0x05 0x2b
    0x82 0x97 0x5c 0x40 0x97 0x05 0x00 0x00 0x93 0x85 0x65 0x0a 0x17 0x05 0x00 0x00 0x13 0x05 0xc5 0x2a
    0x82 0x97 0x5c 0x40 0x97 0x05 0x00 0x00 0x93 0x85 0x05 0x14 0x17 0x05 0x00 0x00 0x13 0x05 0x85 0x2a
    0x82 0x97 0x97 0x07 0x00 0x00 0x93 0x87 0x47 0x0f 0x23 0xa2 0x99 0x00 0x23 0xa0 0xf9 0x00 0xb7 0xc7
    0xcd 0x3f 0x83 0xa7 0x07 0xf0 0x17 0x05 0x00 0x00 0x13 0x05 0xa5 0x29 0x82 0x97 0x4a 0x85 0x49 0xbf
    0x41 0x11 0x22 0xc4 0x37 0xc4 0xcd 0x3f 0x26 0xc2 0x06 0xc6 0xaa 0x84 0x13 0x04 0x04 0xe0 0x83 0x27
    0x44 0x11 0x82 0x97 0x11 0xc5 0xb2 0x40 0x22 0x44 0x92 0x44 0x41 0x01 0x82 0x80 0xdc 0x40 0x13 0x05
    0x40 0x06 0x85 0x07 0xdc 0xc0 0x83 0x27 0xc4 0x0d 0x82 0x97 0xf9 0xbf 0x41 0x11 0x22 0xc4 0x37 0xc4
    0xcd 0x3f 0x83 0x27 0x04 0xf0 0x06 0xc6 0x17 0x05 0x00 0x00 0x13 0x05 0x45 0x1b 0x82 0x97 0x03 0x25
    0xc4 0xe9 0xb2 0x40 0x22 0x44 0x41 0x01 0x82 0x80 0x89 0x47 0x63 0x94 0xf5 0x06 0x41 0x11 0x22 0xc4
    0x37 0xc4 0xcd 0x3f 0x26 0xc2 0x83 0x27 0x44 0xe8 0xaa 0x84 0x08 0x41 0x06 0xc6 0x4a 0xc0 0x13 0x04
    0x04 0xe0 0x82 0x97 0x15 0xc9 0x83 0x27 0x44 0x08 0xc8 0x40 0x82 0x97 0x0d 0xc5 0x7c 0x50 0x88 0x40
    0x82 0x97 0x7c 0x50 0x2a 0x89 0xc8 0x40 0x82 0x97 0xaa 0x85 0x4a 0x85 0x97 0x00 0x00 0x00 0xe7 0x80
    0x20 0x0b 0x7c 0x48 0x22 0x44 0xb2 0x40 0x92 0x44 0x02 0x49 0x41 0x01 0x82 0x87 0xb2 0x40 0x22 0x44
    0xb7 0xc7 0xcd 0x3f 0x03 0xa5 0x07 0xea 0x92 0x44 0x02 0x49 0x41 0x01 0x82 0x80 0xb7 0xc7 0xcd 0x3f
    0x03 0xa5 0x07 0xea 0x82 0x80 0x05 0xcd 0x41 0x11 0x26 0xc2 0xb7 0xc4 0xcd 0x3f 0x22 0xc4 0x83 0xa7
    0x04 0xf1 0x2a 0x84 0x08 0x41 0x06 0xc6 0x82 0x97 0x83 0xa7 0x04 0xf0 0x4c 0x40 0x17 0x05 0x00 0x00
    0x13 0x05 0xc5 0x12 0x82 0x97 0x22 0x85 0x22 0x44 0x83 0xa7 0x84 0xf0 0xb2 0x40 0x92 0x44 0x41 0x01
    0x82 0x87 0x82 0x80 0x41 0x11 0x22 0xc4 0x37 0xc4 0xcd 0x3f 0x83 0x27 0xc4 0xf1 0x06 0xc6 0x17 0x05
    0x00 0x00 0x13 0x05 0x25 0xe1 0x82 0x97 0x1c 0x41 0x13 0x04 0x04 0xe0 0x99 0xc7 0x38 0x44 0x22 0x44
    0xb2 0x40 0xc8 0x43 0x41 0x01 0x02 0x87 0x1c 0x44 0x17 0x05 0x00 0x00 0x13 0x05 0x65 0x10 0x82 0x97
    0x03 0x25 0x44 0x0a 0xb2 0x40 0x22 0x44 0x41 0x01 0x82 0x80 0x37 0x07 0x00 0x80 0xb3 0x47 0xb5 0x00
    0x7d 0x8f 0x93 0x07 0xf0 0x0f 0x13 0x56 0x75 0x01 0x7d 0x8e 0x93 0xd6 0x75 0x01 0xfd 0x8e 0x63 0x05
    0xf6 0x06 0x63 0x83 0xf6 0x06 0x39 0xce 0xb1 0xce 0x36 0x96 0x26 0x05 0xa6 0x05 0xb7 0x06 0x00 0x08
    0x15 0x81 0x95 0x81 0x55 0x8d 0xd5 0x8d 0xb3 0x06 0xb5 0x02 0xb3 0x35 0xb5 0x02 0x3a 0x85 0xb7 0x07
    0x80 0x00 0x63 0xf8 0xf5 0x00 0x86 0x05 0x93 0xd7 0xf6 0x01 0xdd 0x8d 0x86 0x06 0x7d 0x16 0x4d 0x8d
    0x13 0x06 0x16 0xf8 0x93 0x07 0xe0 0x0f 0x63 0x7d 0xf6 0x00 0x37 0x07 0x00 0x80 0x5e 0x06 0x32 0x95
    0x63 0xe6 0xe6 0x00 0x05 0x05 0x63 0x93 0xe6 0x00 0x79 0x99 0x82 0x80 0x63 0x42 0xc0 0x02 0x09 0xa0
    0x3a 0x85 0x82 0x80 0x62 0x06 0xe2 0x06 0x19 0xce 0x91 0xce 0xe2 0x07 0x93 0x16 0x15 0x00 0x63 0xea
    0xd7 0x00 0x93 0x96 0x15 0x00 0x63 0xe6 0xd7 0x00 0x37 0x05 0x80 0x7f 0x59 0x8d 0x82 0x80 0x37 0x05
    0xc0 0x7f 0x82 0x80 0x48 0x65 0x6c 0x6c 0x6f 0x20 0x66 0x72 0x6f 0x6d 0x20 0x74 0x68 0x65 0x20 0x6e
    0x61 0x74 0x69 0x76 0x65 0x20 0x74 0x65 0x73 0x74 0x20 0x6c 0x69 0x62 0x21 0x00 0x54 0x65 0x73 0x74
    0x20 0x6c 0x69 0x62 0x20 0x73 0x74 0x6f 0x70 0x70 0x65 0x64 0x2c 0x20 0x63 0x6f 0x75 0x6e 0x74 0x65
    0x72 0x20 0x77 0x61 0x73 0x20 0x25 0x64 0x00 0x00 0x00 0x00 0x4e 0x6f 0x74 0x20 0x69 0x6e 0x69 0x74
    0x69 0x61 0x6c 0x69 0x7a 0x65 0x64 0x00 0x6c 0x69 0x62 0x5f 0x74 0x65 0x73 0x74 0x00 0x00 0x00 0x00
    0x65 0x78 0x74 0x2d 0x74 0x65 0x73 0x74 0x2d 0x68 0x65 0x6c 0x6c 0x6f 0x00 0x00 0x65 0x78 0x74 0x2d
    0x74 0x65 0x73 0x74 0x2d 0x6d 0x75 0x6c 0x00 0x00 0x00 0x00 0x65 0x78 0x74 0x2d 0x74 0x65 0x73 0x74
    0x2d 0x63 0x6f 0x75 0x6e 0x74 0x65 0x72 0x00 0x00 0x00 0x00 0x4e 0x61 0x74 0x69 0x76 0x65 0x20 0x74
    0x65 0x73 0x74 0x20 0x6c 0x69 0x62 0x20 0x6c 0x6f 0x61 0x64 0x65 0x64 0x00
])

(def target (sysinfo 'hw-target))

(if (eq lib nil)
    (print (str-merge "No native test lib for target " target))
{
    (print (str-merge "Loading native test lib for " target))
    (print (load-native-lib lib))
    (ext-test-hello)
    (print (str-merge "2.5 * 3.0 = " (str-from-n (ext-test-mul 2.5 3.0))))
    (sleep 1)
    (print (str-merge "Counter after 1s (expect ~10): " (str-from-n (ext-test-counter))))
})

I'm in bed but will give it a go in the morning.

@techfoundrynz

Copy link
Copy Markdown
Contributor Author

6169523

Can you check if this commit broke anything? It works for me on the C3. It also allows putting the native library code directly in the source if it is in a const block

@const-start

(def lib [
    0xca 0xfe 0xba 0xbe 0x00 0x00 0x00 0x00 0x01 0x11 0x22 0xcc 0x37 0xc4 0xcd 0x3f 0x13 0x04 0x04 0xe0
    0x97 0x07 0x00 0x00 0x83 0xa7 0x07 0xff 0x4a 0xc8 0x03 0x29 0x04 0x00 0x06 0xce 0x26 0xca 0x4e 0xc6
    0x85 0x47 0x63 0x10 0xf9 0x04 0x83 0x27 0x44 0x10 0xaa 0x89 0x21 0x45 0x82 0x97 0xaa 0x84 0x05 0xc9
    0x83 0x27 0xc4 0x10 0x85 0x65 0x23 0x22 0x05 0x00 0xaa 0x86 0x17 0x06 0x00 0x00 0x13 0x06 0x06 0x2e
    0x93 0x85 0x05 0x80 0x17 0x05 0x00 0x00 0x13 0x05 0x85 0x08 0x82 0x97 0x88 0xc0 0x09 0xed 0x83 0x27
    0x84 0x10 0x26 0x85 0x82 0x97 0x01 0x45 0xf2 0x40 0x62 0x44 0xd2 0x44 0x42 0x49 0xb2 0x49 0x05 0x61
    0x82 0x80 0x5c 0x40 0x97 0x05 0x00 0x00 0x93 0x85 0x65 0x09 0x17 0x05 0x00 0x00 0x13 0x05 0x05 0x2b
    0x82 0x97 0x5c 0x40 0x97 0x05 0x00 0x00 0x93 0x85 0x65 0x0a 0x17 0x05 0x00 0x00 0x13 0x05 0xc5 0x2a
    0x82 0x97 0x5c 0x40 0x97 0x05 0x00 0x00 0x93 0x85 0x05 0x14 0x17 0x05 0x00 0x00 0x13 0x05 0x85 0x2a
    0x82 0x97 0x97 0x07 0x00 0x00 0x93 0x87 0x47 0x0f 0x23 0xa2 0x99 0x00 0x23 0xa0 0xf9 0x00 0xb7 0xc7
    0xcd 0x3f 0x83 0xa7 0x07 0xf0 0x17 0x05 0x00 0x00 0x13 0x05 0xa5 0x29 0x82 0x97 0x4a 0x85 0x49 0xbf
    0x41 0x11 0x22 0xc4 0x37 0xc4 0xcd 0x3f 0x26 0xc2 0x06 0xc6 0xaa 0x84 0x13 0x04 0x04 0xe0 0x83 0x27
    0x44 0x11 0x82 0x97 0x11 0xc5 0xb2 0x40 0x22 0x44 0x92 0x44 0x41 0x01 0x82 0x80 0xdc 0x40 0x13 0x05
    0x40 0x06 0x85 0x07 0xdc 0xc0 0x83 0x27 0xc4 0x0d 0x82 0x97 0xf9 0xbf 0x41 0x11 0x22 0xc4 0x37 0xc4
    0xcd 0x3f 0x83 0x27 0x04 0xf0 0x06 0xc6 0x17 0x05 0x00 0x00 0x13 0x05 0x45 0x1b 0x82 0x97 0x03 0x25
    0xc4 0xe9 0xb2 0x40 0x22 0x44 0x41 0x01 0x82 0x80 0x89 0x47 0x63 0x94 0xf5 0x06 0x41 0x11 0x22 0xc4
    0x37 0xc4 0xcd 0x3f 0x26 0xc2 0x83 0x27 0x44 0xe8 0xaa 0x84 0x08 0x41 0x06 0xc6 0x4a 0xc0 0x13 0x04
    0x04 0xe0 0x82 0x97 0x15 0xc9 0x83 0x27 0x44 0x08 0xc8 0x40 0x82 0x97 0x0d 0xc5 0x7c 0x50 0x88 0x40
    0x82 0x97 0x7c 0x50 0x2a 0x89 0xc8 0x40 0x82 0x97 0xaa 0x85 0x4a 0x85 0x97 0x00 0x00 0x00 0xe7 0x80
    0x20 0x0b 0x7c 0x48 0x22 0x44 0xb2 0x40 0x92 0x44 0x02 0x49 0x41 0x01 0x82 0x87 0xb2 0x40 0x22 0x44
    0xb7 0xc7 0xcd 0x3f 0x03 0xa5 0x07 0xea 0x92 0x44 0x02 0x49 0x41 0x01 0x82 0x80 0xb7 0xc7 0xcd 0x3f
    0x03 0xa5 0x07 0xea 0x82 0x80 0x05 0xcd 0x41 0x11 0x26 0xc2 0xb7 0xc4 0xcd 0x3f 0x22 0xc4 0x83 0xa7
    0x04 0xf1 0x2a 0x84 0x08 0x41 0x06 0xc6 0x82 0x97 0x83 0xa7 0x04 0xf0 0x4c 0x40 0x17 0x05 0x00 0x00
    0x13 0x05 0xc5 0x12 0x82 0x97 0x22 0x85 0x22 0x44 0x83 0xa7 0x84 0xf0 0xb2 0x40 0x92 0x44 0x41 0x01
    0x82 0x87 0x82 0x80 0x41 0x11 0x22 0xc4 0x37 0xc4 0xcd 0x3f 0x83 0x27 0xc4 0xf1 0x06 0xc6 0x17 0x05
    0x00 0x00 0x13 0x05 0x25 0xe1 0x82 0x97 0x1c 0x41 0x13 0x04 0x04 0xe0 0x99 0xc7 0x38 0x44 0x22 0x44
    0xb2 0x40 0xc8 0x43 0x41 0x01 0x02 0x87 0x1c 0x44 0x17 0x05 0x00 0x00 0x13 0x05 0x65 0x10 0x82 0x97
    0x03 0x25 0x44 0x0a 0xb2 0x40 0x22 0x44 0x41 0x01 0x82 0x80 0x37 0x07 0x00 0x80 0xb3 0x47 0xb5 0x00
    0x7d 0x8f 0x93 0x07 0xf0 0x0f 0x13 0x56 0x75 0x01 0x7d 0x8e 0x93 0xd6 0x75 0x01 0xfd 0x8e 0x63 0x05
    0xf6 0x06 0x63 0x83 0xf6 0x06 0x39 0xce 0xb1 0xce 0x36 0x96 0x26 0x05 0xa6 0x05 0xb7 0x06 0x00 0x08
    0x15 0x81 0x95 0x81 0x55 0x8d 0xd5 0x8d 0xb3 0x06 0xb5 0x02 0xb3 0x35 0xb5 0x02 0x3a 0x85 0xb7 0x07
    0x80 0x00 0x63 0xf8 0xf5 0x00 0x86 0x05 0x93 0xd7 0xf6 0x01 0xdd 0x8d 0x86 0x06 0x7d 0x16 0x4d 0x8d
    0x13 0x06 0x16 0xf8 0x93 0x07 0xe0 0x0f 0x63 0x7d 0xf6 0x00 0x37 0x07 0x00 0x80 0x5e 0x06 0x32 0x95
    0x63 0xe6 0xe6 0x00 0x05 0x05 0x63 0x93 0xe6 0x00 0x79 0x99 0x82 0x80 0x63 0x42 0xc0 0x02 0x09 0xa0
    0x3a 0x85 0x82 0x80 0x62 0x06 0xe2 0x06 0x19 0xce 0x91 0xce 0xe2 0x07 0x93 0x16 0x15 0x00 0x63 0xea
    0xd7 0x00 0x93 0x96 0x15 0x00 0x63 0xe6 0xd7 0x00 0x37 0x05 0x80 0x7f 0x59 0x8d 0x82 0x80 0x37 0x05
    0xc0 0x7f 0x82 0x80 0x48 0x65 0x6c 0x6c 0x6f 0x20 0x66 0x72 0x6f 0x6d 0x20 0x74 0x68 0x65 0x20 0x6e
    0x61 0x74 0x69 0x76 0x65 0x20 0x74 0x65 0x73 0x74 0x20 0x6c 0x69 0x62 0x21 0x00 0x54 0x65 0x73 0x74
    0x20 0x6c 0x69 0x62 0x20 0x73 0x74 0x6f 0x70 0x70 0x65 0x64 0x2c 0x20 0x63 0x6f 0x75 0x6e 0x74 0x65
    0x72 0x20 0x77 0x61 0x73 0x20 0x25 0x64 0x00 0x00 0x00 0x00 0x4e 0x6f 0x74 0x20 0x69 0x6e 0x69 0x74
    0x69 0x61 0x6c 0x69 0x7a 0x65 0x64 0x00 0x6c 0x69 0x62 0x5f 0x74 0x65 0x73 0x74 0x00 0x00 0x00 0x00
    0x65 0x78 0x74 0x2d 0x74 0x65 0x73 0x74 0x2d 0x68 0x65 0x6c 0x6c 0x6f 0x00 0x00 0x65 0x78 0x74 0x2d
    0x74 0x65 0x73 0x74 0x2d 0x6d 0x75 0x6c 0x00 0x00 0x00 0x00 0x65 0x78 0x74 0x2d 0x74 0x65 0x73 0x74
    0x2d 0x63 0x6f 0x75 0x6e 0x74 0x65 0x72 0x00 0x00 0x00 0x00 0x4e 0x61 0x74 0x69 0x76 0x65 0x20 0x74
    0x65 0x73 0x74 0x20 0x6c 0x69 0x62 0x20 0x6c 0x6f 0x61 0x64 0x65 0x64 0x00
])

(def target (sysinfo 'hw-target))

(if (eq lib nil)
    (print (str-merge "No native test lib for target " target))
{
    (print (str-merge "Loading native test lib for " target))
    (print (load-native-lib lib))
    (ext-test-hello)
    (print (str-merge "2.5 * 3.0 = " (str-from-n (ext-test-mul 2.5 3.0))))
    (sleep 1)
    (print (str-merge "Counter after 1s (expect ~10): " (str-from-n (ext-test-counter))))
})

S3 target now fails with:

/mnt/c/Repos/express_native/vesc_express/main/lispif_c_lib.c: In function 'ext_load_native_lib':
/mnt/c/Repos/express_native/vesc_express/main/lispif_c_lib.c:617:34: error: 'container_drom' undeclared (first use in this function)
  617 |                 memcpy(&version, container_drom + 4, 4);

I think we just need to add the container_drom declaration inside the S3 code path around line 616.

@techfoundrynz

Copy link
Copy Markdown
Contributor Author

Change in #109 confirmed as fixing S3 targets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants