This is an implementation of a multi-threading package in C language which targets Edsim51 simulator. This project consists of five checkpoints, each with a different test case
- checkpoint 1: cooperative thread-switching
- checkpoint 2: preemptive thread-switching
- checkpoint 3: semaphore + bounded-buffer test case
- checkpoint 4: two producers & one consumer test case
- checkpoint 5: delay function + parking lot test case
One needs Edsim51 to simulate 8051 processor and SDCC to generate Edsim51-targeted files
-
- Small device C compiler
- Open source, free, cross-platform
- Default ISA is Intel mds51
-
- An 8051 microcontroller simulator
- Runs as a Java app
- DI version - simulates a complete embedded system
- SH version - customizable
To get a local copy up and running follow these simple steps.
-
clone the repo
git clone https://github.com/bob1113/thread-pkgs-on-edsim51.git
-
Change into checkpoint directory and compile via run
make
$make sdcc -c testparking.c testparking.c:47: warning 158: overflow in implicit constant conversion testparking.c:73: warning 158: overflow in implicit constant conversion sdcc -c preemptive.c preemptive.c:194: warning 85: in function ThreadCreate unreferenced function argument : 'fp' sdcc -o testparking.hex testparking.rel preemptive.rel
The warnings above can be ignored.
-
Choose the generated
.hex
file and clickLoad
to load it into Edsim51 -
Click
Assm
to convert.hex
file into assembly file -
Click
Run
to execute -
After finishing the simulation, one may clean up the generated files via run
make clean
$make clean del *.hex *.lst *.map *.mem *.rel *.rst *.sym *.asm *.lk
Bob Lai - [email protected]
Project Link - https://github.com/bob1113/thread-pkgs-on-edsim51