danielnilsson9 / bbs-fw

Open source firmware for multiple electric bike motor controllers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Editing firmware binary with bbsfwtool

aalm opened this issue · comments

commented

Was wondering if it would be possible to have the configtool rewrite the binary with precomputed lookup tables to
get rid of the floats ? I optimized those out, but the table I put into __code does depend on wheel_size_inch_x10_u16*.

Thinking that this might be acceptable given wheel size does rarely change after initial setup.

Probably possible but I'm not sure why that would be done since it's not currently an issue. There is a lot of computing time left in each loop iteration.

commented

Probably possible but I'm not sure why that would be done since it's not currently an issue.

I'm/was actually wishing the configtool would allow touching the default config also while at it:D.

There is a lot of computing time left in each loop iteration.

Ok. That's good:). Atleast in --model-large the sdcc seems to avoid optimizing pretty much anything.
Btw. how do you measure that? I don't see myself opening the motor/controller unless it does get broken,
so I won't be having access to the internals, and that got me thinking about using the light output with
logic analyzer, or something for that purpose.

I'm/was actually wishing the configtool would allow touching the default config also while at it:D.

I think the easiest way would be to just have the config tool recompile the firmware in that case if sdcc is allowed to be redistributed. But yeah, I don't know, I will not be doing any work here. Those options are reserved for advanced users at the moment who wants to compile their own version.

Ok. That's good:). Atleast in --model-large the sdcc seems to avoid optimizing pretty much anything. Btw. how do you measure that? I don't see myself opening the motor/controller unless it does get broken, so I won't be having access to the internals, and that got me thinking about using the light output with logic analyzer, or something for that purpose.

Yee, SDCC does very limited optimization I have understood and 8051 architecture is really slow. Luckily its not an issue since the BBS version of the firmware doesn't do any heavy stuff, just some slow UART communication and sensor reading.

I used to toggle the gear sensor pin (by setting it as an output). Code seems to have been removed when TSDZ2 support was introduced but historically it looked like this: https://raw.githubusercontent.com/danielnilsson9/bbs-fw/891ee01ad19b61d738527e2d8db436aa57d1d0f8/src/firmware/main.c

There was also an event log message which seems to have been removed too, should probably be added again.