Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to use the C firmware image file from ams? #2

Open
avsa242 opened this issue Apr 28, 2024 · 2 comments
Open

Possible to use the C firmware image file from ams? #2

avsa242 opened this issue Apr 28, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request question Further information is requested WIP Work is in-progress/has been started

Comments

@avsa242
Copy link
Owner

avsa242 commented Apr 28, 2024

Since FlexSpin allows mixing of spin and C, check to see if the .c image file can be declared as an external object.
If it doesn't have any dependencies or other reasons it won't work technically, it'd be a nice feature as it wouldn't be necessary to translate the tmf8828_image.c to the equivalent spin, and it'd be easier for someone to just go to ams' repository and download it.

@avsa242 avsa242 added enhancement New feature or request question Further information is requested labels Apr 28, 2024
@avsa242 avsa242 self-assigned this Apr 28, 2024
@avsa242 avsa242 added the WIP Work is in-progress/has been started label May 5, 2024
@avsa242
Copy link
Owner Author

avsa242 commented May 5, 2024

This actually works, if the tmf8828_image.c file is modified slightly:

  1. Remove the PROGMEM keyword from the array definition.
  2. Remove the #include lines.

The image therein can then be used by declaring the .c file as an object and calling the driver's set_fw_image() with a pointer to the array and the size const provided (or specified manually).
e.g.,:

obj

    sensor: "sensor.range.tmf8828.spin"
    fw_img: "tmf8828_image.c"

pub main()

    sensor.set_fw_image(@fw_img.tmf8828_image, fw_img.tmf8828_image_length)

@avsa242
Copy link
Owner Author

avsa242 commented May 6, 2024

It seems this doesn't work when building as bytecode. For some reason the address of the firmware image is returned as 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested WIP Work is in-progress/has been started
Projects
None yet
Development

No branches or pull requests

1 participant