BareMetal-C

BareMetal-C Tool Setup for Windows / macOS

0. Conventions, guidelines, and WSL preparation

Conventions:

This is what you should type or copy & paste into computer (example):

type, copy & paste, or take action. 

and if you see a vertical line | to the left of a box, the text in the box with | on the left is the output from the computer (example):

I am the output from the computer


Guidelines:

Windows and macOS:

We strongly recommend you to create a new administrator level user for this class. Some of the software can run more easily.

For the new username, DO NOT use space in the name. Example: JanDoeII is good, while Jan Doe II is bad.


Now that you have created a new user:


WSL prepartion (Windows only):

Click Windows start button and type:

  turn windows features on or off

Run it. Scroll down and check ✔

☑ Windows Subsystem for Linux

and click OK.

Reboot if necessary.

Check your current WSL version:


1. (Windows & macOS) Install GitHub Desktop


2. (Windows & macOS) Install Docker Desktop


### For Windows:


### For macOS:


### For both Windows / macOS:


3. Pull the course software container

Windows and macOS instructions are a bit different here.

For Windows:

For MacOS

4. Check sdcc-include


5. Try tool command line


6. Test the tools (same for Windows and macOS)

Type all the commands from the tool-prompt:

Check sdcc z80dasm and make – all from tool-prompt:

Check sdcc:

sdcc --version

It should say: SDCC : mcs51/z80/.../f8 TD- 4.5.0 #15242 (Linux)

Check sdasz80:

sdasz80 2>&1 | head -n 3

It should say: sdas Assembler V02.00 + NoICE + SDCC mods (Zilog Z80...)

Check z80dasm:

z80dasm -V

It should say: z80dasm, Z80 assembly language generating disassembler...

Check compilation:

We use make to build our C programs.

make DIR='_test_setup' RECURSE=0

and it should say (not exactly, but very similar):

  ...
  NON_HANDLER_OBJ - _test_setup/blinking_running_led.rel
  HANDLER_OBJ     -
  STARTUP_OBJ     - _defaults/startup_no_int.rel
  MEMMAP          - _defaults/memmap.ld
-b _CODE = 0x0100
-b _DATA = 0x4200
-g _STACK_TOP = 0xC000

sdcc -mz80 --no-std-crt0 _defaults/startup_no_int.rel  _test_setup/blinking_running_led.rel -Wl-u -Wl-f,_defaults/memmap.ld -o _test_setup/_test_setup.ihx

>> Generating Binary and Disassembly _test_setup.bin and _test_setup.txs...
sdobjcopy -I ihex -O binary _test_setup/_test_setup.ihx _test_setup/_test_setup.bin
z80dasm -a -l -t -g0 _test_setup/_test_setup.bin 2> /dev/null > _test_setup/_test_setup.txs
2025-12-31 17_13_50 +0700 ------------ built _test_setup.bin ------------

7. Test Clean-up

Go back to the tool prompt and type:

make clean DIR='_test_setup'

and it should say:

    ...
 >> Cleaning artifacts in code folders (recursive)...
    cleaning _test_setup
2025-12-22 23_33_06 +0700 ------------ clean successful ------------

How to logout of the tool prompt.

and get back to tool-prompt:

Log out of tool-prompt. Easy. type ctrl + d or type exit and you will see:

[student]:/BareMetal-C/code # exit
exit

and the prompt changes to PS C:\... (Windows), or name@computername BareMetal-C % (macOS)


8. How to get back to the tool-prompt:


9. Next Step:

Goto set up SimulIDE.


Go back to home page