Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

alevy
Copy link
Member

@alevy alevy commented Dec 18, 2020

Pull Request Overview

This pull request Port the proximity driver to the Tock 2.0 system-call Driver interface.

I simplified enqueue_command a bit by moving the logic into the enter closure.

Testing Strategy

So far, only compiled-tested. I don't have a board with the right peripheral (the nanoble-sense or the clue_nrf52840).

TODO or Help Wanted

Can @arjundeopujari (original author of the driver) maybe test this quickly? Or else someone with one of the two boards that have this driver?

Documentation Updated

  • [] Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

Port the proximity driver to the Tock 2.0 system-call Driver interface.

I simplified `enqueue_command` a bit by moving the logic into the enter
closure. I think it could be improved with different logic that
virtualizes the commands a bit more thoroughly, but that's for another day.
@alevy alevy force-pushed the tock2.0/proximity branch from feafd42 to 265b13b Compare December 18, 2020 02:53
@alevy alevy requested a review from lschuermann December 18, 2020 03:31
Copy link
Contributor

@hudson-ayers hudson-ayers left a comment

Choose a reason for hiding this comment

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

These changes look good.

I did notice while reviewing that run_next_command() calls find_thresholds() internally which triggers unsoundness per #2135 , but that has nothing to do with the changes here.

Copy link
Member

@lschuermann lschuermann left a comment

Choose a reason for hiding this comment

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

This looks pretty good.

It appears I'm unable to comment on unchanged regions, but the comments regarding subscribe in the top of the file seem partially outdated. I don't think such a description is required any more, given that encoding of allow and subscribe is now centrally done in the kernel.

@bradjc bradjc added the tock-2.0 Issues and PRs related to Tock version 2.0. label Dec 18, 2020
@arjundeopujari
Copy link
Contributor

@hudson-ayers @lschuermann Did one of you get a chance to test this with the aforementioned hardware (nano33ble or clue_nrf52840)?

@hudson-ayers
Copy link
Contributor

@hudson-ayers @lschuermann Did one of you get a chance to test this with the aforementioned hardware (nano33ble or clue_nrf52840)?

I did not

@lschuermann
Copy link
Member

@arjundeopujari Unfortunately not, those boards are still on my wishlist.

@arjundeopujari
Copy link
Contributor

@hudson-ayers @lschuermann Okay. I will test them quickly after the call today on one of my nano33ble's

@arjundeopujari
Copy link
Contributor

@alevy Ok. I tested with the original driver and the 2.0 driver and the 2.0 driver consistently generates a data access fault. See below serial output from tockloader.

---| No debug queue found. You can set it with the DebugQueue component.

---| Fault Status |---
Data Access Violation: true
Forced Hard Fault: true
Faulting Memory Address: 0x00000004
Fault Status Register (CFSR): 0x00000082
Hard Fault Status Register (HFSR): 0x40000000

---| App Status |---
App: proximity - [Fault]
Events Queued: 0 Syscall Count: 6 Dropped Callback Count: 0
Restart Count: 0
Last Syscall: Some(ReadOnlyAllow { driver_number: 1, subdriver_number: 2, allow_address: 0x20004800, allow_size: 0 })

========
For more info on CSFR and HFSR reg-fields: https://interrupt.memfault.com/blog/cortex-m-fault-debug#cfsr

Steps to recreate:
Flash the app using bossac -i -e -o 0x40000 -w build/cortex-m4/cortex-m4.tbf -R from /examples/tests/proximity directory on a nano33ble sense board.

Comments: It consistently seems to consistently fault at the same address. Not sure if this could be caused by @hudson-ayers 's claim on the Grant API unsoundness? Original one still works perfectly well. Not sure what is going on here.

@arjundeopujari
Copy link
Contributor

@bradjc Maybe you can double-check this since it seems it should work and you have the board with you.

@phil-levis
Copy link
Contributor

I have seen a data access fault as well. I tracked mine down to __sfp, which is part of finding open FILE structures for fopen, which should not be invoked (it should not be in the binary! newlib is killing me). So something is being corrupted. My best guess is something is wrong with memop. I'm going to try to reproduce the error and track down its cause.

@hudson-ayers
Copy link
Contributor

I saw a data access fault on the UDP example as well once I rebased libtock-c and updated to the new system calls. Haven't had time to dig into it yet

@phil-levis
Copy link
Contributor

I think I found it. crt0.c has inline assembly for invoking memop and it was still using 1.x syscall invocations. I pushed the fix to tock-2.0-dev.

@hudson-ayers
Copy link
Contributor

Pulling in that change fixed my bug as well, thanks!

@phil-levis
Copy link
Contributor

bors r+

@bors
Copy link
Contributor

bors bot commented Dec 24, 2020

@bors bors bot merged commit cc84921 into tock-2.0-dev Dec 24, 2020
@bors bors bot deleted the tock2.0/proximity branch December 24, 2020 00:05
lschuermann pushed a commit to lschuermann/tock that referenced this pull request Mar 20, 2021
2284: Proximity driver to Tock 2.0 system-call interface r=phil-levis a=alevy

### Pull Request Overview

This pull request Port the proximity driver to the Tock 2.0 system-call Driver interface.

I simplified `enqueue_command` a bit by moving the logic into the enter closure.


### Testing Strategy

So far, only compiled-tested. I don't have a board with the right peripheral (the nanoble-sense or the clue_nrf52840).

### TODO or Help Wanted

Can @arjundeopujari (original author of the driver) maybe test this quickly? Or else someone with one of the two boards that have this driver?

### Documentation Updated

- [] ~~Updated the relevant files in `/docs`, or no updates are required.~~

### Formatting

- [X] Ran `make prepush`.


Co-authored-by: Amit Aryeh Levy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tock-2.0 Issues and PRs related to Tock version 2.0.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants