Go to advanced search

by Roger S
Wed Nov 28, 2018 12:15 am
Forum: C/C++
Topic: Problem calling ncurses
Replies: 4
Views: 1739

Re: Problem calling ncurses

Thank you for your reply. I tried using your "asmtest.s" in my code and found that it sometimes worked. I eventually found that initialising my stack pointers was causing it to fail. I am working on a implementation of FORTH so I need more than one stack. I have reworked the initialisation and it se...
by Roger S
Mon Nov 26, 2018 7:58 pm
Forum: C/C++
Topic: Problem calling ncurses
Replies: 4
Views: 1739

Problem calling ncurses

I am having problems calling ncurses from Assembly code. The code I am calling is /* ccalls.c */ #include <ncurses.h> char inchar() { int ch; initscr(); cbreak(); ch =getch(); endwin(); return (ch); } And I am calling it by key_c: bl inchar @ Call c stmea DSTK!, {r0} @ Put on data stack b NEXT Debug...
by Roger S
Wed Nov 21, 2018 12:02 am
Forum: Bare metal, Assembly language
Topic: Failure to link a library
Replies: 6
Views: 2690

Re: Failure to link a library

I realise that I am in the Bare metal, Assembly language section. Elsewhere all I get are replies telling me how to call assembler from c or suggesting that assembler is too hard/not suitable/otherwise no good but no constructive help. Can you tell me what sort of console you use. I need USB capabil...
by Roger S
Tue Nov 20, 2018 12:24 am
Forum: Bare metal, Assembly language
Topic: Failure to link a library
Replies: 6
Views: 2690

Re: Failure to link a library

Thank you for the reply. Using gcc instead of ld seems to have done the trick. However I now get segmentation faults when I run it. The code I am calling is /* ccalls.c */ #include <ncurses.h> char inchar() { int ch; initscr(); cbreak(); ch =getch(); endwin(); return (ch); } And it is called by key_...
by Roger S
Tue Nov 20, 2018 12:10 am
Forum: Bare metal, Assembly language
Topic: Failure to link a library
Replies: 6
Views: 2690

Re: Failure to link a library

Thank you for the reply. Using gcc instead of ld seems to have done the trick. However I now get segmentation faults when I run it. The code I am calling is /* ccalls.c */ #include <ncurses.h> char inchar() { int ch; initscr(); cbreak(); ch =getch(); endwin(); return (ch); } And it is called by key_...
by Roger S
Sun Nov 18, 2018 10:45 pm
Forum: Bare metal, Assembly language
Topic: Failure to link a library
Replies: 6
Views: 2690

Failure to link a library

I am trying to link a C program into some assembly code. I am using gcc as and ld as required and they appear to generate the required file. In detail I do the following:- as -g -o forth.o forth.s gcc -c -o ccalls.o calls.c ld -o forth forth.o calls.o -lncurses However when I try to run it I get:- p...
by Roger S
Fri Oct 05, 2018 4:18 pm
Forum: Bare metal, Assembly language
Topic: Segmentation Faults
Replies: 4
Views: 1710

Re: Segmentation Faults

Thank you for your ideas on this. Is there a difference between .ltorg and .pool? I tried .ltorg but could not see any difference between it and the .pool directive I am already using. I reordered the code and eliminated some included files by bringing them into the main file. This made the faults g...
by Roger S
Tue Oct 02, 2018 7:53 pm
Forum: Bare metal, Assembly language
Topic: Segmentation Faults
Replies: 4
Views: 1710

Segmentation Faults

I am trying to port a version of Forth to a RPi 3 in assembler and I am being plagued by segmentation faults. Most of them I can find a cause and correct it but I am geting a number of elusive faults which I cannot resolve. I have a block of code which is working but ofter when I try to add code or ...
by Roger S
Sun Jan 07, 2018 11:34 pm
Forum: Other programming languages
Topic: Problem with str instruction in as
Replies: 0
Views: 667

Problem with str instruction in as

I an currently porting a version of Forth written for a Microchip PIC to ARM code for my Pi. I am using as and gcc. However I have problems with the following lit: ldr r1, [r12] @ get immediate word add r12, r12, #4 str r1, [r11] @ push on parameter stack THIS INSTRUCTION CAUSES PROBLEMS add r11, r1...

Go to advanced search