Introduction
You should submit your code and report at T-square as well.
In this assignment, you will learn how to read touch screen coordinates and also find the distance of the touch-point from a fixed reference point.
Assignment
In this assignment you are building a simple touch screen coordinate reading program using Nintendo DS Assembly programming with NDS library. Fix a reference point and show distance of touch-point from reference point.
You have to set up SPI and read SPI data correctly. Use Arm 7 to read and use Arm 9 to display the coordinates.
Your screen needs to be updated every 1/60th seconds and the screen should says
"Touch screen reader x=%d y=%d Distance from fixed point: %lf your name"
Please see the lecture notes (lec_arm_prog2.pptx) file to get some initial starting code.
Grading
You demo your screen
and then submit the code in the T-square.
The demo will be during the classroom.
C-code version: 35%
Assembly code version: 65%
Report: 5%
Report should include commented code and simple descriptions. Any problems encountered and solutions
Useful links
ARM GCC Iline Assembler Cookbook
NDS/Tutorials (Especially Day 2)
NDS Programming manual
SPI settings
Compliation
You have to compile ARM7 and ARM9 codes.
This a very basic build script which assumes that arm9.c will run on arm9 and
arm7.c will run on arm7 processors respectively. These 2 files should be
in a folder called "source". It produces touch_without_api.nds. The -O0
option is used when compiling the arm7 code to turn off optimization.
This script also assumes that you installed devKitPro with the default
path
arm-eabi-gcc -O0 -c source\arm7.c -o source\arm7.o -I C:\devKitPro\libnds\include -DARM7 arm-eabi-gcc -o source\arm7.elf source\arm7.o -LC:\devKitPro\libnds\lib -lnds7 -specs=ds_arm7.specs arm-eabi-objcopy -O binary source\arm7.elf source\arm7.bin arm-eabi-gcc -c source\arm9.c -o source\arm9.o -I C:\devKitPro\libnds\include -DARM9 arm-eabi-gcc -o source\arm9.elf source\arm9.o -LC:\devKitPro\libnds\lib -lnds9 -specs=ds_arm9.specs arm-eabi-objcopy -O binary source\arm9.elf source\arm9.bin ndstool -7 source\arm7.bin -9 source\arm9.bin -c touch_without_api_in_asm.nds rm source\arm7.o rm source\arm7.elf rm source\arm7.bin rm source\main.o rm source\arm9.elf rm source\arm9.bin