BartmanAbyss / vscode-amiga-debug

One-stop Visual Studio Code Extension to compile, debug and profile Amiga C/C++ programs compiled by the bundled gcc 12.2 with the bundled WinUAE/FS-UAE.
GNU General Public License v3.0
314 stars 39 forks source link

bss section in chip mem #75

Closed mfamfa closed 1 year ago

mfamfa commented 3 years ago

I fail to put a bss section in chip memory. .section .bss_chip, .bss.MEMF_CHIP, .section .bsschip, attribute((chip)) etc -none is working. Could you point me in the right direction? Thank you.

BartmanAbyss commented 3 years ago

Have you had a look at the included starter project? https://github.com/BartmanAbyss/vscode-amiga-debug/blob/master/template/main.c#L151 This works for data, maybe it also works for BSS. Haven't tried...

mfamfa commented 3 years ago

Thank you. Yes, I first tried to modify the existing macros in gcc8_c_support.h without success.

volatile UBYTE testbuffer[51200] attribute((section (".MEMF_CHIP"))); Will allocate testbuffer in chip memory as data (and increase filesize)

volatile UBYTE testbuffer[51200] attribute((section (".bss"))); Will allocate testbuffer in non-chip memory as bss (and not increase filesize)

volatile UBYTE testbuffer[51200] attribute((section (".bss.MEMF_CHIP"))); Will allocate testbuffer in non-chip memory as bss (and not increase filesize)

I feel that I am missing something fundamental here on what is actually allocating these sections and where.

I poked around a bit in Bebbo's gcc and there is a mention of a "chip" attribute keyword, but it seems not to be present in the gcc included here. Also when searching the source I see .bsschip / .bss_chip but none of them works when trying here.

rjobling commented 2 years ago

I'm running into the same problem.

Any chance this is something relatively easy to fix?

BartmanAbyss commented 2 years ago

I would recommend this "simple" approach (works without linker scripts). Can probably be wrapped into a macro or something for easier reuse:

__asm__(
    ".pushsection .BeEsEs.MEMF_CHIP, \"aw\", @nobits\n"
    ".global beeses\n" 
    "beeses:\n"
    ".balign 2\n"
    ".nop 2048*2\n"
    ".popsection\n"
);
extern unsigned short beeses[2048];

you can ofcourse change the section name .BeEsEs (just not .bss).