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

Interrupt and background data stacks coincide #424

Closed
Eelkhoorn opened this issue Apr 8, 2021 · 3 comments
Closed

Interrupt and background data stacks coincide #424

Eelkhoorn opened this issue Apr 8, 2021 · 3 comments
Assignees
Labels

Comments

@Eelkhoorn
Copy link
Collaborator

The file inc/defconf.inc has two defines for the background data stack size:
BG_STACKSIZE = 32 ; Default size in bytes of data stack for background tasks
BSPPSIZE = 0 ; BG task data stack size (bytes) for memory calculation

BG_STACKSIZE is not used effectively in forth.asm. Both the interrupt datastack and the background data stack grow down from $350 ( for a STM8Sx03 ).

Maybe BG_STACKSIZE is redundant and can be removed while BSPPSIZE is set to 32.
Or did I mis something here?

@TG9541 TG9541 self-assigned this Apr 8, 2021
@TG9541 TG9541 added the bug label Apr 8, 2021
@TG9541
Copy link
Owner

TG9541 commented Apr 8, 2021

Confirmed - thanks a bunch for reporting this!

  1. Applications that use the BG task and an ISR that uses Forth code may suffer from BG task data stack corruption. This quite obviously bad.
  2. The BG stack has been 8 cells deep since the bug was introduced - this can also lead to foreground task stack corruption!

I'll quickly provide a fix. Also a way to check stack bounds overrun will be provided.

@TG9541
Copy link
Owner

TG9541 commented Apr 8, 2021

This happened when I factored out the BG code in #377. It was still OK until the 2.2.26 release. The first release that contained this bug was 2.2.27.pre1. 2.2.27 was released 9/Mar/2021 (today that's a month).

@TG9541
Copy link
Owner

TG9541 commented Apr 8, 2021

That's a Travis-CI / Docker Inc problem:
image

@TG9541 TG9541 closed this as completed in 349a14c Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants