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

Something is overwriting BSS. #298

Closed
jacobly0 opened this issue Feb 6, 2021 · 3 comments
Closed

Something is overwriting BSS. #298

jacobly0 opened this issue Feb 6, 2021 · 3 comments
Labels

Comments

@jacobly0
Copy link
Member

jacobly0 commented Feb 6, 2021

This program misbehaves:

#include <stdio.h>
#include <string.h>
#include <tice.h>

int main() {
    static char bss_protector[0x1000];
    strcpy(&bss_protector[0x000], "first,");
    strcpy(&bss_protector[0x800], " second");
    os_SetCursorPos(0, 0);
    for (int i = 0; i < 11; ++i) {
        os_PutStrFull(&bss_protector[0x000]);
        os_PutStrFull(&bss_protector[0x800]);
        os_NewLine();
    }
    os_GetKey();
}

screenshot

Full project

Note: Was also reproduced while only calling os_NewLine().

@jacobly0 jacobly0 added the bug label Feb 6, 2021
@jacobly0
Copy link
Member Author

The only solution I can find is BSSHEAP_LOW ?= D052C6.

@jacobly0
Copy link
Member Author

Nobody has suggested a better solution, so implementing the only suggestion.

@adriweb
Copy link
Member

adriweb commented Mar 26, 2021

TODO at some point: update https://github.com/CE-Programming/toolchain/blob/master/docs/static/images/mem_layout.png from 0xD031F6 to 0xD052C6 (a 8400-byte reduction) -> Total BSS is now 60690 bytes.
And mention it in the changelog for the next release.

Edit: MateoC did it in 1a1bc4b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants