Develop MCS-51 (8051) on openSUSE
If you want a lightweight Linux workflow for 8051 development, openSUSE + SDCC is enough: edit in vim/emacs, compile with sdcc, convert the output, then flash over serial using a Python script. This post walks through the exact setup.
1. Install an editor (vim/emacs)
Pick one. Example with Emacs:
sudo zypper in emacs
2. Install SDCC
SDCC (Small Device C Compiler) supports the MCS-51 / 8051 family:
sudo zypper in sdcc
3. Download the flashing script (stcflash.py)
Download the Python script:
wget https://github.com/laborer/stcflash/raw/master/stcflash.py
You may also need the serial module:
sudo zypper in python-serial
4. Write your code
Create your source file (for example hello.c) and write your 8051 program.
5. Compile with SDCC
Compile the C source:
sdcc hello.c
This typically produces an Intel HEX intermediate file like hello.ihx.
6. Convert build artifacts
Convert .ihx to .hex, then optionally to a raw binary .bin:
packihx hello.ihx > hello.hex
objcopy -I ihex -O binary hello.hex hello.bin
7. Upload to the chip
Flash your image (hex or bin depending on your workflow). Example:
sudo python stcflash.py -l 9600 hello.hex
If you prefer binary:
sudo python stcflash.py -l 9600 hello.bin
Notes / Tips
- If you hit serial permission issues, add your user to the
dialoutgroup and re-login. - Keep the first program simple (blink a pin / toggle a port) to verify wiring and flashing.
- Once stable, automate build + flash with a Makefile.