Closed e28eta closed 1 year ago
I used fmin() from
In addition, I had linker problems with XC16 on Linux. I had to modify /busPirate.X/nbproject/configurations.xml and remove references to the C30 lib pic30-elf:
I used fmin() from
and replaced NULL with '\0'
Afaik those are reasonable choices too. I didn't want to use fmin
since this is dealing with integers and I didn't check / don't know whether fmin
would trigger an unnecessary conversion to float
.
I think NULL
, '\0
and 0
would all be equivalent (modulo NULL triggering this compiler warning). I personally chose the elvis operator ?:
because it's something I'm familiar with and IMO is more readable when you are.
In addition, I had linker problems with XC16 on Linux. I had to modify /busPirate.X/nbproject/configurations.xml and remove references to the C30 lib pic30-elf: and . I added /opt/microchip/xc16/v2.00/lib/libc99-pic30-elf.a
I saw that too with the Bus Pirate v4 configuration. I managed a successful compile by simply deleting the lib reference, but without the hardware to test on, I didn't want to proffer a fix.
@mleyden I have no idea how active this project is, nor how discriminating the maintainers are, but sounds to me like you've got a set of changes that're a totally reasonable alternative PR to this one. If I were you I'd submit, and maybe we can learn together about which choices are better?
Finally uploaded my changes - see #167
Fixes #163
I ran into the same issue compiling the firmware for the first time. These seem like pretty straightforward fixes to me, but I could be wrong. I have very little experience with the Bus Pirate, and was unable to even confirm that I'm hitting these code paths, but the firmware compiles now and I believe these are equivalent statements.
Compiler error:
Remove calls to
min()
since I can't find it in the headers. I suspect there is amin
function we could use for readability, but I don't see it declared anywhere in XC16'smicrochip/xc16/v2.00/include
directory, and there were only two instances in a single file, so this seemed okay.Compiler error:
Instead of comparing an integer (aka char) against NULL, simply use the short form of the ternary operator. Documented here: https://gcc.gnu.org/onlinedocs/gcc/Conditionals.html