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

AVR support #2021

Open
wants to merge 28 commits into
base: dev
Choose a base branch
from
Open

Conversation

glennsec
Copy link

@glennsec glennsec commented Oct 2, 2024

Hi, this adds support for AVR (#939), while keeping XMEGA bits (with DES instruction) currently separate. This PR is rebased against the current dev branch, while original support was developed and more thoroughly tested against unicorn 2.0.x.

@glennsec glennsec force-pushed the to_upstream/feature/avr branch from 3b071ab to 7c958ea Compare October 2, 2024 14:11
break;

// Initialize registers
uint8_t regs[32];
Copy link
Member

Choose a reason for hiding this comment

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

please move all the variable declaration to the beginning of the function

Copy link
Author

Choose a reason for hiding this comment

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

done

@aquynh
Copy link
Member

aquynh commented Oct 3, 2024

Thanks for the contribution!

  • please update README to add this new architecture.
  • please add your name to CREDITS.TXT.

@aquynh
Copy link
Member

aquynh commented Oct 3, 2024

can you look at the issues of the CI?

@bet4it
Copy link
Contributor

bet4it commented Oct 3, 2024

You need to add Rust bindings manually😅

@glennsec glennsec force-pushed the to_upstream/feature/avr branch from 7c958ea to ade427c Compare October 8, 2024 13:00
@glennsec
Copy link
Author

glennsec commented Oct 9, 2024

Thanks for the contribution!

  • please update README to add this new architecture.
  • please add your name to CREDITS.TXT.

done

@glennsec
Copy link
Author

glennsec commented Oct 9, 2024

can you look at the issues of the CI?

Fixed all of those except arm64 & ppc64 failures. The arm64 bits may be fixed by #1935 ?

@wtdcode
Copy link
Member

wtdcode commented Oct 10, 2024

can you look at the issues of the CI?

Fixed all of those except arm64 & ppc64 failures. The arm64 bits may be fixed by #1935 ?

There are also macos failures.

@glennsec
Copy link
Author

can you look at the issues of the CI?

Fixed all of those except arm64 & ppc64 failures. The arm64 bits may be fixed by #1935 ?

There are also macos failures.

Hi, this is related to the tcg/aarch64 backend issue mentioned in #1908 with proposed fix in #1935. I have another patch suggestion that fixes the issue, as you can see in the last CI run at https://github.com/glennsec/unicorn/actions/runs/11298077207
(still, ppc64 needs similar treatment).

@glennsec
Copy link
Author

See #2028. Feel free to integrate whichever (vs. #1935) suits you best. Thanks.

@glennsec glennsec force-pushed the to_upstream/feature/avr branch from ade427c to 237c20e Compare October 22, 2024 13:04
@glennsec
Copy link
Author

See #2028. Feel free to integrate whichever (vs. #1935) suits you best. Thanks.

@wtdcode : I have updated the branch against #1935 (which applies on top of current dev branch) to include aarch64 & ppc64 fixes. Thanks.

@wtdcode
Copy link
Member

wtdcode commented Oct 22, 2024

See #2028. Feel free to integrate whichever (vs. #1935) suits you best. Thanks.

@wtdcode : I have updated the branch against #1935 (which applies on top of current dev branch) to include aarch64 & ppc64 fixes. Thanks.

I will have a check this week.

@glennsec glennsec force-pushed the to_upstream/feature/avr branch from 237c20e to 9a25b59 Compare October 22, 2024 14:41
@in7egral
Copy link

I'm looking forward for this PR, as my idaemu fork will be redesigned soon, and I wish to add AVR as well.

@aquynh @wtdcode what's have to be done for merge?

@wtdcode
Copy link
Member

wtdcode commented Nov 11, 2024

I'm looking forward for this PR, as my idaemu fork will be redesigned soon, and I wish to add AVR as well.

@aquynh @wtdcode what's have to be done for merge?

Thanks for reaching out. Unfortunately I'm getting sick recently. Please allow me a few days before coming back.

glennsec and others added 13 commits January 17, 2025 14:13
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Add AVR related definitions into QEMU, make AVR support buildable.

[AM: Remove word 'Atmel' from filenames and all elements of code]
Suggested-by: Aleksandar Markovic <aleksandar.m.mail@gmail.com>
Signed-off-by: Michael Rolnik <mrolnik@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Aleksandar Markovic <aleksandar.m.mail@gmail.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Thomas Huth <huth@tuxfamily.org>
Message-Id: <20200705140315.260514-23-huth@tuxfamily.org>
[PMD: Fixed @avr tag in qapi/machine.json]
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

(cherry picked from commit 42f3ff001339e37df4f13b709d2db00a488ee45c)
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
This is needed because the AVR CPU has separate code and data address
spaces that both start from zero. Use 0x08000000 base for Flash memory
and 0x00000000 base for CPU registers, IO registers and SRAM as the
fast case.

Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Separate AVR architectures ("avr5", "avr51", "avr6", etc.) from actual
MCU models. Only list the most representative MCU models.

Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
This fixes CI tests on MingW64.

Signed-off-by: Glenn Baker <glenn.baker@gmx.com>
@glennsec glennsec force-pushed the to_upstream/feature/avr branch from 9a25b59 to 7fa65eb Compare January 17, 2025 18:18
@glennsec
Copy link
Author

Hi @wtdcode, I have fixed the new test failures wrt. the current dev branch. All tests now pass. Do you see anything left you would like me to change prior to committing the patchset to the dev branch? Thanks.

@wtdcode
Copy link
Member

wtdcode commented Jan 18, 2025

Hi @wtdcode, I have fixed the new test failures wrt. the current dev branch. All tests now pass. Do you see anything left you would like me to change prior to committing the patchset to the dev branch? Thanks.

Thanks for updates. This PR will go to 2.2.0 as mentioned in #2071 as I hope 2.1.2 to be released firstly to address a few urgent issues. I'm sorry for the delay as I'm busy with my academic matters.

Regarding the PR itself, I once quickly reviewed the code and I didn't see obvious flaws or request changes. The quality of integration is rather high and professional. I will take another look once 2.1.2 is out, which should happen shortly.

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.

6 participants