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

Endianness related errors and warnings while running avrdude -c '*/u' on s390x #1917

Open
ndim opened this issue Aug 30, 2024 · 16 comments · May be fixed by #1921
Open

Endianness related errors and warnings while running avrdude -c '*/u' on s390x #1917

ndim opened this issue Aug 30, 2024 · 16 comments · May be fixed by #1921
Labels
wontfix This will not be worked on

Comments

@ndim
Copy link
Contributor

ndim commented Aug 30, 2024

Building a package for Fedora implies not only the x86_64 architecture, but also s390x.

However, running avrdude -c '*/u' fails there (full build log at https://kojipkgs.fedoraproject.org//work/tasks/1593/122671593/build.log).

I do not know whether this points to some portability problems in the avrdude sources which should be fixed in avrdude, or whether this just means I should not build for s390x at all.

It is obvious that nobody will use a mainframe to programm a microcontroller with, but building for that mainframe might still expose bugs in the sources. So here it is for you to draw some conclusions.

[...]
+ redhat-linux-build/src/avrdude -C redhat-linux-build/src/avrdude.conf -c '*/u'
Warning: invalid page size 0, ignored [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3601]
Warning: invalid page size 0, ignored [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3610]
Warning: invalid page size 0, ignored [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3618]
Warning: invalid page size 0, ignored [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3624]
Error: Common values for reduced core tinys's fuse memory location [0x820000, 0x81ffff] straddles memory section boundary 0x830000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3632]
Error: Common values for reduced core tinys's lockbits memory location [0x830000, 0x82ffff] straddles memory section boundary 0x840000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3632]
Error: Common values for reduced core tinys's signature memory location [0x840000, 0x83ffff] straddles memory section boundary 0x850000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3632]
Error: Common values for reduced core tinys's sram memory location [0x800000, 0x7fffff] straddles memory section boundary 0x810000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3632]
Warning: invalid page size 0, ignored [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3652]
Error: ATtiny4's fuse memory location [0x820000, 0x81ffff] straddles memory section boundary 0x830000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3660]
Error: ATtiny4's lockbits memory location [0x830000, 0x82ffff] straddles memory section boundary 0x840000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3660]
Error: ATtiny4's signature memory location [0x840000, 0x83ffff] straddles memory section boundary 0x850000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3660]
Error: ATtiny4's sram memory location [0x800000, 0x7fffff] straddles memory section boundary 0x810000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3660]
Error: ATtiny4's io memory location [0x800000, 0x7fffff] straddles memory section boundary 0x810000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3660]
Error: ATtiny5's fuse memory location [0x820000, 0x81ffff] straddles memory section boundary 0x830000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3676]
Error: ATtiny5's lockbits memory location [0x830000, 0x82ffff] straddles memory section boundary 0x840000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3676]
Error: ATtiny5's signature memory location [0x840000, 0x83ffff] straddles memory section boundary 0x850000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3676]
Error: ATtiny5's sram memory location [0x800000, 0x7fffff] straddles memory section boundary 0x810000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3676]
Error: ATtiny5's io memory location [0x800000, 0x7fffff] straddles memory section boundary 0x810000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3676]
Warning: invalid page size 0, ignored [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3696]
Error: ATtiny9's fuse memory location [0x820000, 0x81ffff] straddles memory section boundary 0x830000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3704]
Error: ATtiny9's lockbits memory location [0x830000, 0x82ffff] straddles memory section boundary 0x840000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3704]
Error: ATtiny9's signature memory location [0x840000, 0x83ffff] straddles memory section boundary 0x850000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3704]
Error: ATtiny9's sram memory location [0x800000, 0x7fffff] straddles memory section boundary 0x810000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3704]
Error: ATtiny9's io memory location [0x800000, 0x7fffff] straddles memory section boundary 0x810000
Warning: revise fileio_mem_offset(), avrdude.conf entry or memory type assignment [/builddir/build/BUILD/avrdude-8.0-build/avrdude-8.0/redhat-linux-build/src/avrdude.conf:3704]
Error: ATtiny10's fuse memory location [0x820000, 0x81ffff] straddles memory section boundary 0x830000
[...]
@ndim ndim changed the title Error running avrdude -c '*/u' on s390x Errors and warnings while running avrdude -c '*/u' on s390x Aug 30, 2024
@mcuee mcuee added the unconfirmed Maybe a bug, needs to be reproduced by someone else label Aug 30, 2024
@mcuee
Copy link
Collaborator

mcuee commented Aug 30, 2024

I tend to think just ignore S390x as no one would probably use avrdude on an S390x machine.

But maybe it is interesting to find the root cause.

@stefanrueger
Copy link
Collaborator

stefanrueger commented Aug 31, 2024

It will be the endianness of the machine. I noticed several places where the code relies on little-endian hosts, and added comments to that effect. We might want to make AVRDUDE become more general. Great to see that we can test on a s390x.

Edit: Little prio, though, as it's involved, time-consuming and (currently) with little practical use.

@stefanrueger stefanrueger added wontfix This will not be worked on and removed unconfirmed Maybe a bug, needs to be reproduced by someone else labels Sep 1, 2024
@mcuee mcuee closed this as completed Sep 1, 2024
@mcuee
Copy link
Collaborator

mcuee commented Sep 1, 2024

Closed as not-planned then.

@mcuee mcuee reopened this Sep 1, 2024
@mcuee mcuee closed this as not planned Won't fix, can't repro, duplicate, stale Sep 1, 2024
@stefanrueger stefanrueger reopened this Sep 1, 2024
@stefanrueger stefanrueger closed this as not planned Won't fix, can't repro, duplicate, stale Sep 1, 2024
@ndim
Copy link
Contributor Author

ndim commented Sep 3, 2024

Would it make sense if the build aborted when it detects it is about to build avrdude for a non little endian system?

@mcuee
Copy link
Collaborator

mcuee commented Sep 3, 2024

Would it make sense if the build aborted when it detects it is about to build avrdude for a non little endian system?

Sounds like a good idea.

@mcuee
Copy link
Collaborator

mcuee commented Sep 3, 2024

No so sure if there are still relevant embedded Linux system which use big endian system.
https://en.wikipedia.org/wiki/Endianness

Some instruction set architectures are "bi-endian" and allow running software of either endianness; these include Power ISA, SPARC, ARM AArch64, C-Sky, and RISC-V. IBM AIX and IBM i run in big-endian mode on bi-endian Power ISA; Linux originally ran in big-endian mode, but by 2019, IBM had transitioned to little-endian mode for Linux to ease the porting of Linux software from x86 to Power.[25][26] SPARC has no relevant little-endian deployment, as both Oracle Solaris and Linux run in big-endian mode on bi-endian SPARC systems, and can be considered big-endian in practice. ARM, C-Sky, and RISC-V have no relevant big-endian deployments, and can be considered little-endian in practice.

@mcuee
Copy link
Collaborator

mcuee commented Sep 3, 2024

@dl8dtl

From the above Wikipedia entry, the only problem is with SPARC. I guess we do not need to worry about it and we can drop the support. Any objections?

But you mentioned that avrdude used to run okay on the Sun Sparc machine, right?

@ndim
Copy link
Contributor Author

ndim commented Sep 4, 2024

Doesn't NetBSD run on just about anything which is Turing Complete?

Let me come up with a build time check, and we will see which builds start failing, for big endian systems on which avrdude probably has not been tested on for a long time.

@mcuee mcuee reopened this Sep 4, 2024
@ndim ndim linked a pull request Sep 5, 2024 that will close this issue
@ndim ndim changed the title Errors and warnings while running avrdude -c '*/u' on s390x Endianness related errors and warnings while running avrdude -c '*/u' on s390x Sep 5, 2024
@dl8dtl
Copy link
Contributor

dl8dtl commented Sep 5, 2024

From the above Wikipedia entry, the only problem is with SPARC.

UltraSPARC is probably no longer of much interest for us (sadly). After Oracle buying Sun, they turned it into a sole high-price database server solution. (Sun also sold a number of lower-price devices.)

AFAICT, PowerPC(64) might still be a relevant thing though these days that is commonly big-endian. In FreeBSD, it's a Tier2 platform (like RISC-V, 32-bit ARMv7, and right now also i386 – to be phased out).

If it's possible to fix the build errors and warnings, I'd very much prefer that over dropping big-endian support.

If the s390x helps us with regular builds, the better. ;-)

@dl8dtl
Copy link
Contributor

dl8dtl commented Sep 5, 2024

Could we get a recent build log including the corresponding avrdude.conf (to see which line numbers it refers to)?

@ndim
Copy link
Contributor Author

ndim commented Sep 5, 2024

@dl8dtl Stock avrdude-8.0.tar.gz s390x scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=123000005 https://koji.fedoraproject.org/koji/taskinfo?taskID=123000024

That build log contains the output of cat avcdude.conf | nl -ba | sed 's|^|===|' which can be reversed easily: Download the build.log file (which will become unavailable within a week or two), then sed -n 's|^=== *[1-9][0-9]*\t||p' build.log > avrdude.conf.

I have attached to this comment both

compressed with gzip for storage size and GitHub compatibility.

@ndim
Copy link
Contributor Author

ndim commented Sep 5, 2024

Perhaps the qemu-s390x or qemu-mips64 or qemu-ppc64 or qemu-ppc-sparc64 system emulators could be helpful here with a Debian system image or something like that.

@mcuee
Copy link
Collaborator

mcuee commented Sep 6, 2024

AFAICT, PowerPC(64) might still be a relevant thing though these days that is commonly big-endian. In FreeBSD, it's a Tier2 platform (like RISC-V, 32-bit ARMv7, and right now also i386 – to be phased out).

Good point about PowerPC(64) for FreeBSD. Big Endian and Little Endian version are both offered but it seems to me Big Endian version is more popular.
https://www.freebsd.org/platforms/ppc

It is said that Linux on PPC64 now mostly use Little Endian now.

As for legacy MacOS PPC64, last version is Mac OS X 10.5.8 Leopard released on August 13, 2009. So maybe it does not matter any more. Even macports says that it is not supported.
https://ports.macports.org/port/avrdude/details/

@mcuee
Copy link
Collaborator

mcuee commented Sep 6, 2024

NetBSD still lists PPC64, MIPS64 and SPARC64 as tier one support system. And it says both big endian (eb) and little endian (el) MIPS are supported.
https://wiki.netbsd.org/ports/

@mcuee
Copy link
Collaborator

mcuee commented Sep 6, 2024

OpenBSD PPC64 and Sparc64 are probably big endian as well.
https://www.openbsd.org/plat.html

@mcuee
Copy link
Collaborator

mcuee commented Sep 6, 2024

  1. Linux Endian Issues
    https://kernelnewbies.org/EndianIssues

  2. Redhat Enterprise Linux -- using Little Endian for PowerPC, but Big Endian for IBM Z

https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/9.4_release_notes/architectures#architectures
AMD and Intel 64-bit architectures (x86-64-v2)
The 64-bit ARM architecture (ARMv8.0-A)
IBM Power Systems, Little Endian (POWER9)
64-bit IBM Z (z14)

https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/8/html/8.10_release_notes/architectures
AMD and Intel 64-bit architectures
The 64-bit ARM architecture
IBM Power Systems, Little Endian
64-bit IBM Z

  1. IBM S390X is still using Big Endian
    https://community.ibm.com/community/user/ibmz-and-linuxone/blogs/javier-perez1/2021/01/19/endianness-guidance-for-open-source-projects?communityKey=64d1d1bd-66bc-4ecb-b9e8-0372b18c5bcb

Benefits of expanding support to s390x processor architecture and big-endian format
While IBM Power Systems have moved to little-endian and Oracle no longer sells SPARC servers, the s390x platforms (IBM Z and LinuxONE) continue to grow. Commonly known as mainframes, these are modern platforms with a very large ecosystem of open-source software that has been growing since Linux support started more than 20 years ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants