Skip to content

Add DCB::enable_trace() and DCB::disable_trace() #111

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

Merged
merged 10 commits into from
Sep 6, 2018

Conversation

kellerkindt
Copy link
Contributor

@kellerkindt kellerkindt commented Sep 2, 2018

This is required for the cycle counter of DWT to work, if the power supply has been unplugged since the last time it has been flashed japaric/stm32f103xx-hal/issues/76.
See bit 24 here http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0337e/CEGHJDCF.html

Corresponding PR in stm32f103xx-hal: japaric/stm32f103xx-hal/pull/94

@kellerkindt kellerkindt requested a review from a team as a code owner September 2, 2018 09:36
@kellerkindt
Copy link
Contributor Author

kellerkindt commented Sep 2, 2018

Also, a PR for the MonoTimer in stm32f103xx-hal (calling enable_trace() before enable_cycle_counter()) will follow, as soon as I can fix these local dependency issues, which occured once I updated to the latest version of cortex-m. But this might be an easier PR, if this one was already merged then.

166 |     let timer = ::stm32f103xx_hal::time::MonoTimer::new(cp.DWT, clocks);
    |                                                         ^^^^^^ expected struct `stm32f103xx::DWT`, found struct `cortex_m::peripheral::DWT`
    |
    = note: expected type `stm32f103xx::DWT`
               found type `cortex_m::peripheral::DWT`

Anyone familiar with this error?

EDIT: Now having this issue

warning: Linking globals named 'CORE_PERIPHERALS': symbol multiply defined!

error: failed to load bc of "cortex_m.8ussh43s-cgu.6": 

EDIT2: Got it working, had two different versions of cortex-m in local and indirect dependencies, fixed via [replace] in the Cargo.toml .

korken89
korken89 previously approved these changes Sep 3, 2018
Copy link
Contributor

@korken89 korken89 left a comment

Choose a reason for hiding this comment

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

Hi, good catch!
I will approve for now but wait a bit for more comments from @rust-embedded/cortex-m if they want to change something.

@thejpster
Copy link
Contributor

It's a read/modify/write but it takes a mut ref, so that's ok. I think I'd prefer 1 << 24 to be a const instead of being duplicated, but that's pretty minor. Happy as is really.

@adamgreig
Copy link
Member

👍 for the feature, but I would also really prefer a DWTENA const instead of 1<<24. Also I don't think this PR should bump the crate version number; we'll do that when ready to release.

@kellerkindt
Copy link
Contributor Author

kellerkindt commented Sep 5, 2018

@thejpster @adamgreig Just moved the the shift to the constant BIT_TRCENA (since TRCENA is used in the arm documentation).

@adamgreig The version bump is needed by japaric/stm32f103xx-hal/pull/94, but I am open for other suggestions to resolve that.

@adamgreig
Copy link
Member

Oh I see, in ARMv6-M it's DWTENA but in ARMv7-M it's TRCENA. That's fine. Could you use something like DCB_DEMCR_TRCENA instead of BIT_TRCENA and 1 << 24 instead of 0x01 << 24 to be consistent with the other modules?

For the version number, it still shouldn't be updated in this PR - once this PR is landed and we're ready to cut a new release (which can be essentially right away) there will be a new PR for the new release (updating the changelog too), and once that's published on crates.io your PR to stm32f103xx-hal will be possible to merge.

@adamgreig
Copy link
Member

Thanks! LGTM, I'll approve but I'll let @korken89 re-approve and merge if they're happy since they reviewed it earlier.

@kellerkindt
Copy link
Contributor Author

@adamgreig Here you go :)

Who is going to to handle the PR for the new version? At my location its quite late and I need to get up early tomorrow. So no new commits/comments from me for the next 18h to 20h.

Copy link
Contributor

@therealprof therealprof left a comment

Choose a reason for hiding this comment

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

LGTM, too.

@korken89
Copy link
Contributor

korken89 commented Sep 6, 2018

Thanks for the extra checks and changes all!

bors r+

bors bot added a commit that referenced this pull request Sep 6, 2018
111: Add DCB::enable_trace() and DCB::disable_trace() r=korken89 a=kellerkindt

This is required for the cycle counter of DWT to work, if the power supply has been unplugged since the last time it has been flashed japaric/stm32f103xx-hal/issues/76.
See bit 24 here http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0337e/CEGHJDCF.html

Corresponding PR in stm32f103xx-hal: japaric/stm32f103xx-hal/pull/94

Co-authored-by: kellerkindt <[email protected]>
Co-authored-by: Michael Watzko <[email protected]>
@bors
Copy link
Contributor

bors bot commented Sep 6, 2018

Build succeeded

@bors bors bot merged commit 9b74fda into rust-embedded:master Sep 6, 2018
@kellerkindt kellerkindt mentioned this pull request Sep 6, 2018
bors bot added a commit that referenced this pull request Sep 6, 2018
114: Release 0.5.7 r=japaric a=kellerkindt

As mentioned in /pull/111 (#111 (comment)), releasing 0.5.7 will allow the merge of japaric/stm32f103xx-hal/pull/94 which then allows japaric/stm32f103xx-hal/issues/76 to be resolved.

Co-authored-by: Michael Watzko <[email protected]>
Co-authored-by: Jorge Aparicio <[email protected]>
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.

5 participants