Roger Jansson
Roger Jansson

Reputation: 11

Problem using Open Watcom v2 for generating a bare metal application for 80186 CPU

I'm trying to use Open Watcom v2 to generate a bare metal application for an 80186 CPU. I have 64KB of ROM(flash) at 0xF0000 and 64 KB of RAM at 0x0 (there is more but this is enough for what I want to do now). My problem seems to be in the linking process where I can't place data and code as suggested by my link file. In the documentation for wlink, in the description of the "order" directive, there is an example for an AM186ER that is almost identical to what I want to do. My simple test application consists basically of some assembly files to initiate the hardware, a cstart file in assembly based on one found in watcom sources for 16-bit apps and a very simple main in C. The source files compiles and links fine otherwise with wasm, wcc and wlink if not constrained to much with linker directives.

When linking I get error messages indicating "invalid relocation for flat memory model..." and I can't get the SEGADDR option to work but using the OFFSET option seems to give some almost working result. I'm using the "FORMAT RAW BIN". By looking at the help output from wlink I get the impression that SEGADDR perhaps shouldn't work and maybe FORMAT RAW only works for a flat memory model and not a segmented. I have been testing numerous variants of the commands in my linker script and so far without complete success. Have also searched internet and Open Watcom documentation for clues but not found anything that really explains the process. I’m using an Open Watcom v2 build from Jan 1st 2024 on win 64-bit but have also tested with an older build on ubuntu with same results.

So I have a couple of questions: Is what I'm trying to do possible at all with Open Watcom v2? If it is, could someone give some guidance or perhaps an example on how it should be done for a segmented 80186 Processor?

I can also provide some code and commands for the simple example I’m testing with but I think my first question should be answered first.

Thanks in advance!

Upvotes: 1

Views: 94

Answers (0)

Related Questions