Skip to content

Instantly share code, notes, and snippets.

@lschuermann
Created June 25, 2019 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lschuermann/0300ef19fceb7658fe8c874ccec3319f to your computer and use it in GitHub Desktop.
Save lschuermann/0300ef19fceb7658fe8c874ccec3319f to your computer and use it in GitHub Desktop.
Tock OS fault with IPC and Nordic ble-uart
Hi! We're having quite some trouble getting an IPC client app to work together with BLE on hail.
We're using the `ble-uart` example app and just included these lines:
```
static char buf[64] __attribute__((aligned(64)));
int hotp_svc_num = 0;
bool calledback = false;
static void hotp_callback(__attribute__ ((unused)) int pid,
__attribute__ ((unused)) int len,
__attribute__ ((unused)) int arg2, void* ud) {
calledback = true;
}
```
and in the main function before the example code
```
hotp_svc_num = ipc_discover("hotpservice"); // We've checked, this does not return an error
ipc_register_client_cb(hotp_svc_num, hotp_callback, buf);
```
We've been trying to debug this for a long time now but don't really know what to do anymore.
Removing the `ipc_register_client_cb`-call from main works, but with it, the following fault happens:
```
Kernel panic at /.../tock/kernel/src/process.rs:537:
"Process ble-uart had a fault"
Kernel version release-1.2-2018-06-985-gc4ffb50b
---| Debug buffer not empty. Flushing. May repeat some of last message(s):
Initialization complete. Entering main loop
---| Fault Status |---
Data Access Violation: true
Forced Hard Fault: true
Faulting Memory Address: 0x20005000
Fault Status Register (CFSR): 0x00000082
Hard Fault Status Register (HFSR): 0x40000000
---| App Status |---
App: ble-uart - [Fault]
Events Queued: 0 Syscall Count: 3 Dropped Callback Count: 0
Restart Count: 0
Last Syscall: Some(MEMOP { operand: 11, arg0: 536896392 })
╔═══════════╤══════════════════════════════════════════╗
║ Address │ Region Name Used | Allocated (bytes) ║
╚0x20006000═╪══════════════════════════════════════════╝
│ ▼ Grant 800 | 800
0x20005CE0 ┼───────────────────────────────────────────
│ Unused
0x20004C00 ┼───────────────────────────────────────────
│ ▲ Heap 536890368 | 536894688 S
0x00000000 ┼─────────────────────────────────────────── R
│ Data 3758077952 | 3758077952 A
0x20004800 ┼─────────────────────────────────────────── M
│ ▼ Stack 40 | 2048
0x200047D8 ┼───────────────────────────────────────────
│ Unused
0x20004000 ┴───────────────────────────────────────────
.....
0x00040000 ┬─────────────────────────────────────────── F
│ App Flash 65492 L
0x0003002C ┼─────────────────────────────────────────── A
│ Protected 44 S
0x00030000 ┴─────────────────────────────────────────── H
R0 : 0x20004BC0 R6 : 0x0003002C
R1 : 0x00000000 R7 : 0x20004000
R2 : 0x20006388 R8 : 0x00000000
R3 : 0x20005000 R10: 0x00000000
R4 : 0x0003002C R11: 0x00000000
R5 : 0x20004800 R12: 0x00000000
R9 : 0x20004800 (Static Base Register)
SP : 0x200047D8 (Process Stack Pointer)
LR : 0x000306E7
PC : 0x00036BB0
YPC : 0x00000000
APSR: N 1 Z 0 C 0 V 0 Q 0
GE 0 0 0 0
EPSR: ICI.IT 0x00
ThumbBit true
To debug, run `make debug RAM_START=0x20004000 FLASH_INIT=0x30055`
in the app's folder and open the .lst file.
App: hotpservice - [Yielded]
[...]
```
We'd be glad for any hints.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment