Skip to content
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

Intermittent MemMgtFault on stm32l4x6-nucleo #1095

Closed
agkaminski opened this issue Jun 14, 2024 · 9 comments · Fixed by phoenix-rtos/phoenix-rtos-kernel#562
Closed

Intermittent MemMgtFault on stm32l4x6-nucleo #1095

agkaminski opened this issue Jun 14, 2024 · 9 comments · Fixed by phoenix-rtos/phoenix-rtos-kernel#562

Comments

@agkaminski
Copy link
Member

For now seen once on CI (https://github.com/phoenix-rtos/phoenix-rtos-project/actions/runs/9502217223/job/26189746156):

 phoenix-rtos-tests/psh/history: FAIL
SHELL ERROR: Couldn't find a prompt!
EXPECTED: (psh)% 
OUTPUT:
ciE3fGUFgW2uIV~_

Exception: 4 #MemMgtFault
 r0=00000001  r1=00000071  r2=00000071  r3=40004400
 r4=2000d434  r5=2000d150  r6=2000d370  r7=2000d430
 r8=00000002  r9=20009d30 r10=2000d32c r11=20013e88
r12=00000001 psr=21000000  lr=0802195d  pc=08021966
psp=2000d318 msp=20017200 exr=fffffffd bfa=40004400
cfs=00000082 mma=40004400

Seems like psh might be trying to access USART2 CR1 register for some reason. Did not look further into this issue.

@damianloew
Copy link
Contributor

  • Discovered for a second time on 5eabbc3 with the following output:
Exception: 4 #MemMgtFault  
r0=00000001  r1=0000003f  r2=0000003f  r3=40004400
r4=2000d434  r5=2000d150  r6=2000d370  r7=2000d430
r8=00000002  r9=20009d30 r10=2000d32c r11=20013e88
r12=00000001 psr=21000000  lr=0802195d  pc=08021966
psp=2000d318 msp=20017200 exr=fffffffd bfa=40004400
cfs=00000082 mma=40004400

https://github.com/phoenix-rtos/plo/actions/runs/9546062432/job/26308199690

  • Seems to happen from time to time

@agkaminski
Copy link
Member Author

There's a slight chance that phoenix-rtos/phoenix-rtos-kernel#561 might fix it

@anglov
Copy link
Member

anglov commented Jun 17, 2024

PC:

269     static int tty_uartenabled(tty_ctx_t *ctx)
270     {
271             return (*(ctx->base + cr1) & 1) ? 1 : 0;
   0x08021962 <+530>:   ldr.w   r3, [r5, #512]  @ 0x200
   0x08021966 <+534>:   ldr     r3, [r3, #0]

285                             while (((tty_dmarxready(ctx) == 0) && (tty_dmatxready(ctx) == 0)) || (tty_uartenabled(ctx) == 0)) {
   0x08021968 <+536>:   lsls    r3, r3, #31
   0x0802196a <+538>:   bpl.w   0x80217c2 <tty_dmathread+114>
   0x0802196e <+542>:   b.n     0x8021804 <tty_dmathread+180>

235                     libtty_wake_reader(&ctx->ttyCommon);
   0x08021970 <+544>:   mov     r0, r6
   0x08021972 <+546>:   bl      0x8024048 <libtty_wake_reader>
   0x08021976 <+550>:   b.n     0x80218f0 <tty_dmathread+416>
   0x08021978 <+552>:   lsls    r0, r2, #3
   0x0802197a <+554>:   movs    r0, r0

LR:

257     static int tty_dmatxready(tty_ctx_t *ctx)
258     {
259             return ((ctx->data.dma.txDoneFlag != 0) && (libtty_txready(&ctx->ttyCommon) != 0)) ? 1 : 0;
   0x08021956 <+518>:   mov     r0, r6
   0x08021958 <+520>:   bl      0x8023d5c <libtty_txready>
   0x0802195c <+524>:   cmp     r0, #0
   0x0802195e <+526>:   beq.w   0x80217c2 <tty_dmathread+114>

260     }
(gdb) info registers 
r0             0x1                 1
r1             0x39                57
r2             0x39                57
r3             0x40004400          1073759232
r4             0x2000d434          536925236
r5             0x2000d150          536924496
r6             0x2000d370          536925040
r7             0x2000d430          536925232
r8             0x1                 1
r9             0x20009d30          536911152
r10            0x2000d32c          536924972
r11            0x20013e88          536952456
r12            0x1                 1
sp             0x2000d318          0x2000d318
lr             0x802195d           134355293
pc             0x8021966           0x8021966 <tty_dmathread+534>
xPSR           0x21000000          553648128
fpscr          0x0                 0
msp            0x20017200          0x20017200
psp            0x2000d318          0x2000d318
primask        0x0                 0
basepri        0x0                 0
faultmask      0x0                 0
control        0x3                 3

Looks like code path that are reached in normal work and works fine.

@adamdebek
Copy link
Contributor

adamdebek commented Jun 18, 2024

I checked on 5beec45 and 69bcce0. Errors still occur, in my opinion it looks like error pertaining to process creation.

image

@Darchiv
Copy link
Member

Darchiv commented Jun 18, 2024

I checked on 5beec45 and errors still occur. In my opinion it looks like error pertaining to process creation.

image

Maybe you can try phoenix-rtos/phoenix-rtos-kernel#553?

@adamdebek
Copy link
Contributor

I checked on 5beec45 and errors still occur. In my opinion it looks like error pertaining to process creation.
image

Maybe you can try phoenix-rtos/phoenix-rtos-kernel#553?

I see it failed during merge to master, so I assume this pr needs further changes.

@anglov
Copy link
Member

anglov commented Jun 19, 2024

At the first glance it looks fixed by phoenix-rtos/phoenix-rtos-kernel#562

@adamdebek could you also check?

@adamdebek
Copy link
Contributor

At the first glance it looks fixed by phoenix-rtos/phoenix-rtos-kernel#562

@adamdebek could you also check?

Yea, tests are running already.

@adamdebek
Copy link
Contributor

I ran over 200 test companies during night and not single one failed, so this confirm the issue is resolved.

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 a pull request may close this issue.

5 participants