0 Members and 1 Guest are viewing this topic.
Quote from: yoshi13 on May 22, 2010, 08:55:56 pmThanks to bwang, to access time use Code: [Select] int time = * (unsigned*) 0x90090000 Since that is memory-mapped hardware, you need to use * (volatile unsigned*)
Thanks to bwang, to access time use Code: [Select] int time = * (unsigned*) 0x90090000
int time = * (unsigned*) 0x90090000
#include <os.h>#include <common.h>#include <utils.h>asm(".string \"PRG\"\n");int main() { int antx = 160; int anty = 120; int dir = 1; while (!isKeyPressed(KEY_NSPIRE_ESC)) { if (getpixel(antx,anty) == 15) { setpixel(anty,antx,0); dir = dir - 1; } else { setpixel(anty,antx,15); dir = dir + 1; } if (dir == 0) dir = 4; else if (dir == 5) dir = 1; if (dir == 1) antx = antx - 1; else if (dir == 2) anty = anty + 1; else if (dir == 3) antx = antx + 1; else anty = anty - 1; if (antx == 0) antx = 320; else if (antx == 321) antx = 1; if (anty == 0) anty = 240; else if (anty == 241) anty = 1; } return 0;}
arm-elf-gcc -mcpu=arm7tdmi -O3 -Wall -W -fpie -fno-merge-constants -c -I./headers -D NON_CAS main.cIn file included from ./headers/os.h:17, from main.c:1:./headers/common.h:62:20: warning: missing whitespace after the macro name./headers/common.h:71:22: warning: missing whitespace after the macro name./headers/common.h:114:20: warning: missing whitespace after the macro name./headers/common.h:114:1: warning: "KEY_NSPIRE_" redefined./headers/common.h:62:1: warning: this is the location of the previous definition./headers/common.h:116:20: warning: missing whitespace after the macro name./headers/common.h:116:1: warning: "KEY_NSPIRE_" redefined./headers/common.h:114:1: warning: this is the location of the previous definitionmain.c: In function 'setPixel':main.c:23: warning: implicit declaration of function 'getpixel'main.c:24: warning: implicit declaration of function 'setpixel'main.c:52: warning: 'return' with a value, in function returning voidmain.c: In function 'main':main.c:53: error: expected declaration or statement at end of inputmake: *** [main.o] Error 1
#include <os.h>//notice the quotes around utils.h#include "utils.h"asm(".string \"PRG\"\n");int main(){ int antx = 160; int anty = 120; int dir = 1; while (!isKeyPressed(KEY_NSPIRE_ESC)) { if (getPixel(antx,anty) == 15) { setPixel(anty,antx,0); dir = dir - 1; } else { setPixel(anty,antx,15); dir = dir + 1; } if (dir == 0) dir = 4; else if (dir == 5) dir = 1; if (dir == 1) antx = antx - 1; else if (dir == 2) anty = anty + 1; else if (dir == 3) antx = antx + 1; else anty = anty - 1; if (antx == 0) antx = 320; else if (antx == 321) antx = 1; if (anty == 0) anty = 240; else if (anty == 241) anty = 1; } return 0;}
process_begin: CreateProcess(C:\Users\Amar\Desktop\skeleton\tools\MakeTNS\MakeTNS, ./tools/MakeTNS/MakeTNS demo.bin demo-noncas.tns, ...) failed.make (e=193): Error 193make: *** [demo] Error 193