Merge pull request #221 from jmgao/dwt_cold_boot_0.4.x

Enable the DWT unit before poking at its registers. (v0.4.x)
This commit is contained in:
Jorge Aparicio 2019-08-20 11:11:36 +00:00 committed by GitHub
commit 8d28b536c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -507,7 +507,6 @@ fn post_init(ctxt: &Context, app: &App, analysis: &Analysis) -> proc_macro2::Tok
// Enable cycle counter
if cfg!(feature = "timer-queue") {
exprs.push(quote!(p.DCB.enable_trace()));
exprs.push(quote!(p.DWT.enable_cycle_counter()));
}
@ -2024,6 +2023,8 @@ fn pre_init(ctxt: &Context, app: &App, analysis: &Analysis) -> proc_macro2::Toke
// Set the cycle count to 0 and disable it while `init` executes
if cfg!(feature = "timer-queue") {
// We need to explicitly enable the trace block to set CYCCNT.
exprs.push(quote!(p.DCB.enable_trace();));
exprs.push(quote!(p.DWT.ctrl.modify(|r| r & !1);));
exprs.push(quote!(p.DWT.cyccnt.write(0);));
}