Hello,
On Sat, 3 Aug 2024, Michael Tokarev wrote:
It's been a long time since everyone's fighting with u-boot-sam460ex
code which is very bad, suffers from countless issues.
For one, it does not compile for quite a long time with current compilers.
QEMU comes with a binary so normally there's no reason to compile it for
most people so I don't think everyone has to fight with it. You're the
first who complained.
For example, here are changes which I apply to this code when building
things on Debian:
https://salsa.debian.org/qemu-team/qemu/-/tree/master/debian/patches/
(see u-boot-sam460ex-* files in there). I just created another patch,
u-boot-sam460ex-build.patch, to address numerous new issues revealed by
gcc-14 and its new defaults in Debian.
Please note that most of the last patch are actually just workarounds,
not real fixes, - real fixes needs much more than that.
For example, there are a LOT of *conflicting* function declarations in
.c files where the functions are being used, instead of writing them in
a common .h file and including in both users and where it's defined.
It is based on an old U-Boot version but it needs sam460ex specific
patches that weren't upstreamed by the vendor of this machine so we have
to use this old version.
There are a lot of free conversions between pointer and integer. Some of the
functions almost always used with a pointer but expects an integer, or vise
versa.
This code is awful.
But.
Can at least this minimal set of changes be comitted, to let this source to
be compiled at least somehow? For the benefit of everyone.
The last patch (-build) also fixes a real bug:
char arr[8] = { 0 };
- i2c_write(0x68, 0x08, 1, &arr, 8);
+ i2c_write(0x68, 0x08, 1, arr, 8);
I could push some of the fixes but there's an updated firmware version
from the vendor since which may be based on a newer U-Boot (still an old
one from 2015 or before) but has newer version of the sam460ex patches
that may fix some of the problems. So maybe it's better to look at
updating to that version. I would not touch it for 9.1 though as the
current one is at least known to work, so I don't want to break it just
before the release and also don't have time for it now.
Regards,
BALATON Zoltan