Skip to content

cpotteck/soen442-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

soen442-project

Commands

Note: the following commands were written and executed with Windows Command Prompt in mind. They were not tested on a Linux shell and from our experience, some might break on PowerShell.

Note: the following commands assume that you are in the root directory of the repository before each step.

Task 0

Compile aunit:

gcc aunit.c -o aunit

Run aunit:

aunit.exe

Task 1 & Task 2

Change directory:

cd cm

Compile cm:

gcc -DConsoleOutputWithPrintf bsl_console.c bsl_COut.c bsl_xtoa.c admin.c hal.c hal_ioreg.c bsl_ioreg.c out.c vm.c vmstack.c -o cm
 

Copy the created cm.exe into /tests/

Copy the created aunit.exe from Task 0 into /tests/

Change directory:

cd ..
cd tests

Run the tests:

run_aunit_tests.bat

Task 3

Change directory:

cd cm

Compile source files and flash to Arduino:

Note: your COM port might be different! Substitute the port in the third command with yours before running.

avr-gcc -Os -Wall -DF_CPU=16000000UL -mmcu=atmega328p -D IORegToMockUart -D DebugXtoa bsl_console.c bsl_COut.c bsl_xtoa.c hal.c hal_ioreg.c bsl_ioreg.c out.c vm.c vmstack.c -o debug_xtoa.o
avr-objcopy -O ihex -j .text -j .data debug_xtoa.o  debug_xtoa.hex
avrdude -c arduino -p atmega328p -b 57600 -P COM8 -D -Uflash:w:debug_xtoa.hex:i
 

Check serial monitor of target for output

Task 4

Change directory:

cd cm

Compile source files and flash to Arduino:

Note: same as in Task 3, your COM port might be different! Substitute the port in the third command with yours before running.

avr-gcc -Os -Wall -DF_CPU=16000000UL -mmcu=atmega328p -D IORegToMockUart -D TestTargetPrecompiled main_arduino.c bsl_console.c bsl_COut.c bsl_xtoa.c hal.c hal_ioreg.c bsl_ioreg.c out.c vm.c vmstack.c -o cm_testArduino_precompiled.o
avr-objcopy -O ihex -j .text -j .data cm_testArduino_precompiled.o  cm_testArduino_precompiled.hex
avrdude -c arduino -p atmega328p -b 57600 -P COM8 -D -Uflash:w:cm_testArduino_precompiled.hex:i
 

Check serial monitor of target for output

Task 5

Change directory:

cd cm

Compile loader:

Note: replace the COM port value with yours.

gcc -DTARGET_PORT=\"COM8\" target_loader.c windows_comm.c -o target_loader

Compile target source files and flash Arduino:

Note: replace the COM port value in the third command with yours.

avr-gcc -Os -Wall -DF_CPU=16000000UL -mmcu=atmega328p -D IORegToMockUart main_arduino.c bsl_console.c bsl_COut.c bsl_xtoa.c hal.c hal_ioreg.c bsl_ioreg.c out.c vm.c vmstack.c -o cm_testArduino_loader.o
avr-objcopy -O ihex -j .text -j .data cm_testArduino_loader.o  cm_testArduino_loader.hex
avrdude -c arduino -p atmega328p -b 57600 -P COM8 -D -Uflash:w:cm_testArduino_loader.hex:i
 

Use the target loader to load and run a program onto the arduino:

target_loader.exe -send /tests/T01.exe

Task 6

Change directory:

cd cm

Test test_interman0.c on target:

# compile with test_interman0.c
avr-gcc -Os -Wall -DF_CPU=16000000UL -mmcu=atmega328p -D IORegToMockUart -DInterruptManagerOn test_interman0.c hal_interman.c bsl_interman.c bsl_console.c bsl_COut.c bsl_xtoa.c hal.c hal_ioreg.c bsl_ioreg.c out.c vm.c vmstack.c -o test_interman0.o
avr-objcopy -O ihex -j .text -j .data test_interman0.o  test_interman0.hex
avrdude -c arduino -p atmega328p -b 57600 -P COM8 -D -Uflash:w:test_interman0.hex:i
 

Test test_interman1.c on target:

# compile with test_interman1.c
avr-gcc -Os -Wall -DF_CPU=16000000UL -mmcu=atmega328p -D IORegToMockUart -DInterruptManagerOn test_interman1.c hal_interman.c bsl_interman.c bsl_console.c bsl_COut.c bsl_xtoa.c hal.c hal_ioreg.c bsl_ioreg.c out.c vm.c vmstack.c -o test_interman1.o
avr-objcopy -O ihex -j .text -j .data test_interman1.o  test_interman1.hex
avrdude -c arduino -p atmega328p -b 57600 -P COM8 -D -Uflash:w:test_interman1.hex:i
 

Test hal_TestInterman0.c on target:

# compile with hal_TestInterman0.c
avr-gcc -Os -Wall -DF_CPU=16000000UL -mmcu=atmega328p -D IORegToMockUart -DInterruptManagerOn hal_TestInterman0.c hal_interman.c bsl_interman.c bsl_console.c bsl_COut.c bsl_xtoa.c hal.c hal_ioreg.c bsl_ioreg.c out.c vm.c vmstack.c -o hal_TestInterman0.o
avr-objcopy -O ihex -j .text -j .data hal_TestInterman0.o  hal_TestInterman0.hex
avrdude -c arduino -p atmega328p -b 57600 -P COM8 -D -Uflash:w:hal_TestInterman0.hex:i
 

Check serial monitor of target for output of tests

Task 7

Change directory:

cd cm

Test bsl_TestIOReg0.c on target:

avr-gcc -Os -Wall -DF_CPU=16000000UL -mmcu=atmega328p -D IORegToMockUart -D TestTargetIOReg bsl_TestIOReg0.c bsl_console.c bsl_COut.c bsl_xtoa.c hal.c bsl_ioreg.c hal_ioreg.c out.c vm.c vmstack.c -o bsl_TestIOReg0.o
avr-objcopy -O ihex -j .text -j .data bsl_TestIOReg0.o  bsl_TestIOReg0.hex
avrdude -c arduino -p atmega328p -b 57600 -P COM8 -D -Uflash:w:bsl_TestIOReg0.hex:i
 

Check serial monitor of target for output

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published