Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Last fixes for v1#53

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ThomasWaldmann merged 4 commits intomicropython:masterfromwnienhaus:fixes-for-v1
Oct 9, 2021

Conversation

@wnienhaus
Copy link
Collaborator

@wnienhauswnienhaus commentedOct 7, 2021
edited
Loading

I have now fixed the last issues for passing binutils-esp32ulp tests.

Those fixes relate to handling peripheral register addresses correctly with thereg_rd andreg_wr opcodes. While the machine instruction needs the "direct ULP address", the assembly opcode can take either direct ULP addresses or full DPORT bus addresses. binutils-esp32ulp internally converts full addresses to direct addresses and thus supports both. We attempted to support both, but had a few bugs related direct ULP addresses. These are now fixed. (More details in the commits)

You will notice I added a crude "patching mechanism" in the02_compat_rtc_tests.sh because I needed to work around the bug related to global/not-global absolute symbols (as discussed in PR#52). The workaround was to make all symbols used in problem cases global, because that case binutils-esp32ulp handles correctly.

When this is merged, I guess we can consider the v1 milestone (#49) reached.

binutils-esp32ulp allows peripheral registers to be specifiedeither as a full address (e.g. 0x3ff48000) or as a direct ULPaddress (e.g. 0x120), i.e. the address as seen from the ULP."direct" addresses are anything from 0x0 to 0x3ff (inclusive).This change ensures that 0x3ff is included in what is treatedas a direct ULP address.(Seehttps://github.com/espressif/binutils-esp32ulp/blob/249ec34/gas/config/tc-esp32ulp_esp32.c#L145for reference to how binutils treats anything larger thanDR_REG_MAX_DIRECT (0x3ff) as a full address, so everythingless *AND* equal to DR_REG_MAX_DIRECT is therefore a directULP address.)This commit contributes to being able to eventually assemble theesp32ulp_ranges.s test from binutils-esp32ulp. It addresses this line:https://github.com/espressif/binutils-esp32ulp/blob/249ec34/gas/testsuite/gas/esp32ulp/esp32/esp32ulp_ranges.s#L136
When register addresses less than or equal to 0x3ff are given to thereg_rd and reg_wr opcodes, these addresses should be used unmodifiedas the address in the machine instruction.In our implementation we split the 10 bit address field of the machineinstruction into two fields, namely "addr" for the lower 8 bits and"periph_sel" for the upper 2 bits.We already had a mechanism for determining the periph_sel part for"full" addresses (e.g. 0x3ff48000), but for direct (ULP) addresses, wealways set periph_sel to 0 instead of using the upper 2 bits from thegiven address. This commit fixes that.Note 1: In binutils-esp32ulp, they don't split the address into these 2fields but simply put the direct ULP address into a single combinedfield of 10 bits, which has the same effect. See:https://github.com/espressif/binutils-esp32ulp/blob/249ec34/gas/config/tc-esp32ulp_esp32.c#L145Note 2: In the "macro approach" in esp-idf for creating ULP code, theyalso use the split field approach (I assume our implementation ismodelled after that) and they also don't handle direct (ULP) addressescorrectly (or seemingly at all). See:https://github.com/espressif/esp-idf/blob/9d34a1c/components/ulp/include/esp32/ulp.h#L349This commit contributes to being able to eventually assemble theesp32ulp_ranges.s test from binutils-esp32ulp. It addresses this line:https://github.com/espressif/binutils-esp32ulp/blob/249ec34/gas/testsuite/gas/esp32ulp/esp32/esp32ulp_ranges.s#L136
There is no need to duplicate the "<= DR_REG_MAG_DIRECT" checkin two functions. Now the _soc_reg_to_ulp_periph_sel() functionis used only for "full addresses" (as it was some commits ago)and will return a ValueError if used with direct ULP addresses.This commit also masks values correctly when setting the addrand periph_sel fields for "direct ULP addresses", so only thebits we're interested in actually get used (rather than beingimplicitly trimmed because there aren't more bits available ina field).
Everything necessary to pass previously skipped binutils-esp32ulp tests isnow fixed. So we no longer need to skip them. (Tests using unsupportedfeatures, such as assembler macros, are still skipped.)Note 1: There is one test, esp32ulp_ranges.s, which requires symbols definedin esp32ulp_globals.s. binutils-esp32ulp joins these during the linking stagein its test scripts. Since we don't separate stages, we simply concatenate thetwo files before assembly.Note 2: binutils-esp32ulp has a bug related to how absolute symbols definedwith .set are interpreted by the JUMP instruction. If a symbol is markedglobal, the value is taken as-is, but if a symbol is not global, it's valueis divided by 4. Since py-esp32-ulp treats the symbol value the same, whetherglobal or not (the believed correct behaviour), we work around the bug in ourtest script and patch the input files to make the relevant symbols global.
Copy link
Collaborator

@ThomasWaldmannThomasWaldmann left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for fixing!

@wnienhauswnienhaus mentioned this pull requestOct 9, 2021
@ThomasWaldmannThomasWaldmann merged commit037bc58 intomicropython:masterOct 9, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@ThomasWaldmannThomasWaldmannThomasWaldmann approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@wnienhaus@ThomasWaldmann

[8]ページ先頭

©2009-2025 Movatter.jp