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

machine: add Microblaze support for Zephyr toolchain (32-bit, little-endian) #441

Merged
merged 1 commit into from
Mar 10, 2023

Conversation

alpsayin
Copy link
Collaborator

@alpsayin alpsayin commented Mar 8, 2023

Utilises the existing sources. Forked off of zephyr's picolibc mirror to be able to collect consistent results from its CI.

Helps meson pick the microblaze cpu family from microblazeel tool.
do-microblazeel-configure then picks cross-microblazeel-zephyr-elf.txt
zephyr only supports little-endian so far (last I checked), thus I never bothered to make Zephyr sdk-ng produce a big-endian toolchain. Hence no picolibc support for microblaze-zephyr-elf (big-endian is default).

No QEMU test set because QEMU invokation would need a -hw-dtb file such as
https://github.com/zephyrproject-rtos/zephyr/blob/713b955801c44aadf2e66ed972b83da8ca03d837/boards/microblaze/qemu_microblaze/board-qemu-microblaze-demo.dtb

But @keith-packard and I agree that, that's the next step. Let's see with this PR first if it builds.

Future work?

  1. Vitis shipped microblaze-xilinx-elf toolchain support?

EDIT/Update: it seems there is no CI here.
EDIT/Update2: Of course there isn't. I'll open a draft PR in sdk-ng as usual.
EDIT/Update3: Future work.

@alpsayin alpsayin marked this pull request as ready for review March 8, 2023 18:53
@alpsayin alpsayin marked this pull request as draft March 8, 2023 18:55
@alpsayin alpsayin changed the title machine: add Microblaze support zephyr machine: add Microblaze support for Zephyr toolchain (32-bit, little-endian) Mar 8, 2023
.github/do-linux Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@keith-packard keith-packard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How much testing has this seen? Did you actually try the machine-specific APIs on a target?

Only changes required are to not include this in CI (yet), and fix the copyrights to exclude me from the list.

scripts/do-microblaze-configure Outdated Show resolved Hide resolved
scripts/do-microblaze-configure Outdated Show resolved Hide resolved
@keith-packard
Copy link
Collaborator

When you've fixed the CI issues, I can let CI run, but it won't tell us much. Please let me know how much testing you've managed to do.

@alpsayin
Copy link
Collaborator Author

alpsayin commented Mar 9, 2023

How much testing has this seen? Did you actually try the machine-specific APIs on a target?

1st iteration: None.
Current iteration b52120d: It builds and builds tests if I disable atomic-ungetc. I was also able to compile a no-stdio C program with the output specs.
Using the Zephyr SDK toolchain zephyr-sdk-0.16.0-beta1-7-g2a8106a from zephyrproject-rtos/sdk-ng#630
I'll try to load some of the test executables into a QEMU machine.
I may also write a run-microblaze script to automate testing the executables.

@alpsayin
Copy link
Collaborator Author

alpsayin commented Mar 9, 2023

Did you actually try the machine-specific APIs on a target?

Could you elaborate on what you mean by machine-specific APIs?

@keith-packard
Copy link
Collaborator

How much testing has this seen? Did you actually try the machine-specific APIs on a target?

1st iteration: None. Current iteration b52120d: It builds and builds tests if I disable atomic-ungetc.

Hrm. What's the deal with atomic ungetc? Does the target have atomic operations of some size? Is it like RISC-V and only support atomic 32- and 64- bit operations? (there are code paths for that, btw). Without atomic ungetc, stdio isn't re-entrant as it doesn't otherwise need (or provide) any locking.

I was also able to compile a no-stdio C program with the output specs. Using the Zephyr SDK toolchain zephyr-sdk-0.16.0-beta1-7-g2a8106a from zephyrproject-rtos/sdk-ng#630 I'll try to load some of the test executables into a QEMU machine. I may also write a run-microblaze script to automate testing the executables.

That's awesome. If you manage that, and can do something like the arm semi-hosting (or even the x86 'e9' hack) you should be able to run the complete picolibc test suite without any code outside of picolibc. There's no requirement for merging to picolibc though; lots of hosts just don't have any semihosting support yet.

@keith-packard
Copy link
Collaborator

Did you actually try the machine-specific APIs on a target?

Could you elaborate on what you mean by machine-specific APIs?

Yes: all of the code in newlib/libc/machine/microblaze. None of that will get any testing using other targets, so some level of validation would be helpful, even if done just once by hand.

Copy link
Collaborator

@keith-packard keith-packard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spurious #endif in abort.c seems wrong to me?

@keith-packard
Copy link
Collaborator

We'll let CI run on this now; when that passes (which it should, unless we've missed something), I'll get it merged.

…endian)

Signed-off-by: Alp Sayin <alpsayin@gmail.com>
@alpsayin
Copy link
Collaborator Author

alpsayin commented Mar 9, 2023

  1. Rebased on main
  2. Renamed scripts/do-microblaze-configure -> scripts/do-microblazeel-configure
  3. Disabled fstack-protector for tests to stop build from moaning about unsupported option
  4. while loop condition that is also an assignment is placed in parentheses to stop build warnings.
  5. Fixed licenses.

@keith-packard keith-packard merged commit c6f93af into picolibc:main Mar 10, 2023
@alpsayin alpsayin deleted the microblaze branch March 10, 2023 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants