Go to advanced search

by 9k1l4oc8
Mon Dec 16, 2019 5:21 am
Forum: Bare metal, Assembly language
Topic: BX LR Seg Fault
Replies: 20
Views: 2125

Re: BX LR Seg Fault

The only issue I have is that if I only use GCC then I get the following error. Assembler messages: Error: selected processor does not support `movt R5,#0x003D' in ARM mode That's because Raspbian's gcc defaults to generating code for armv6 to be compatible with the RPi0 and instructions like movt ...
by 9k1l4oc8
Mon Dec 16, 2019 4:20 am
Forum: Bare metal, Assembly language
Topic: BX LR Seg Fault
Replies: 20
Views: 2125

Re: BX LR Seg Fault

The imortant thing to read up on is the ARM C Function Calling Convention. This is, as the name suggests, not an intrinsic part of assembly language but a convention for calling 'C' functions, that printf() uses, for instance. It makes sense to use it even for your own private assembler functions. ...
by 9k1l4oc8
Sun Dec 15, 2019 6:24 am
Forum: Bare metal, Assembly language
Topic: BX LR Seg Fault
Replies: 20
Views: 2125

Re: BX LR Seg Fault

Thank you both so much! Paeryn and rpdom that was so helpful! I think I have my code all fixed up thanks to you two. I did not realize there was an AND instruction, not that I have really taken the time to find every last instruction. That was much better. Also I couldn't figure out how to exit prop...
by 9k1l4oc8
Sun Dec 15, 2019 3:09 am
Forum: Bare metal, Assembly language
Topic: BX LR Seg Fault
Replies: 20
Views: 2125

Re: BX LR Seg Fault

Thanks for the suggestions, code is fixed now mostly. I am still getting a seg fault on line number 31. Any ideas? Do you see anything else that I am doing wrong? Also I don't understand the align directive and research on it does not reveal much. How does it work? Does it affect all code after it o...
by 9k1l4oc8
Thu Dec 12, 2019 9:22 am
Forum: Bare metal, Assembly language
Topic: BX LR Seg Fault
Replies: 20
Views: 2125

Re: BX LR Seg Fault

Hi, I'm definitely not an expert but from the code snippets you shared I assume you expect the link return address register (LR) to be "stacked". But it's not. So whenever you do a branch link call BL the contents of the LR register will be updated containing the last return address. But ...
by 9k1l4oc8
Thu Dec 12, 2019 3:18 am
Forum: Bare metal, Assembly language
Topic: BX LR Seg Fault
Replies: 20
Views: 2125

BX LR Seg Fault

I am getting a segmentation fault. When I use gdb it seems to keep going between the instructions on lines 35 to 37 (last three lines of print_r2). I expect for it to pop the other two values back in and then go to the next instruction at line 14. Everything worked before I tried to print register 2...
by 9k1l4oc8
Wed Dec 11, 2019 7:30 pm
Forum: Bare metal, Assembly language
Topic: ARM ASM && printf
Replies: 13
Views: 1398

Re: ARM ASM && printf

When compiled with 'ld' I get the following: file: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /usr/lib/ld.so.1, not stripped ldd: not a dynamic executable When compiled with 'gcc' I get the following: file: ELF 32-bit LSB executable, ARM, EABI5 version 1 ...
by 9k1l4oc8
Wed Dec 11, 2019 7:13 pm
Forum: Bare metal, Assembly language
Topic: ARM ASM && printf
Replies: 13
Views: 1398

Re: ARM ASM && printf

Is there a way to fix that? I see you passing -lc to LD and succeeding, does anything else still go wrong? Also did you manage solve the "not a dynamic executable" issue? It would be nice if you can leave an explanation to help potential future viewers. Nothing else goes wrong. It compile...
by 9k1l4oc8
Wed Dec 11, 2019 7:45 am
Forum: Bare metal, Assembly language
Topic: ARM ASM && printf
Replies: 13
Views: 1398

Re: ARM ASM && printf

Solved the issue, but I still have questions. Code changes are below. .global _start _start: @ Setup PUSH {R11, LR} MOV R1, #0 @ total MOV R2, #3 @ counter MOV R3, #3 MOV R4, #5 MOV R5, #1000 @ max main_loop: MOV R6, R2 MOV R7, R3 BL mod CMP R6, #0 BEQ sum MOV R6, R2 MOV R7, R4 BL mod CMP R6, #0 BNE...
by 9k1l4oc8
Wed Dec 11, 2019 5:17 am
Forum: Bare metal, Assembly language
Topic: ARM ASM && printf
Replies: 13
Views: 1398

Re: ARM ASM && printf

Ran the lscpu command Architecture: armv7l Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 1 Model: 4 Model name: ARMv7 Processor rev 4 (v7l) CPU max MHz: 1400.0000 CPU min MHz: 600.0000 BogoMIPS: 38.40 Flags: half thumb fastmult vf...
by 9k1l4oc8
Wed Dec 11, 2019 4:40 am
Forum: Bare metal, Assembly language
Topic: ARM ASM && printf
Replies: 13
Views: 1398

Re: ARM ASM && printf

'file program' returns this: "program: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /usr/lib/ld.so.1, not stripped" It is very strange, I can't run it even though it is executable. I am SSH into the pi and I am compiling everything on there and ed...
by 9k1l4oc8
Wed Dec 11, 2019 4:04 am
Forum: Bare metal, Assembly language
Topic: ARM ASM && printf
Replies: 13
Views: 1398

Re: ARM ASM && printf

New issue. Thank you guys so much! That fixed those issues, but it brought up a new issue of the program not running after compiling. I added the '-lc' after the 'ld' command. That fixed the C printf issue. Now it says "-bash: ./program: No such file or directory" when I run "./progra...
by 9k1l4oc8
Wed Dec 11, 2019 2:55 am
Forum: Bare metal, Assembly language
Topic: RPi4 vs. RPi3
Replies: 2
Views: 792

Re: RPi4 vs. RPi3

How long did it take for raspberry pi 3 documentation to come out after the board was released?
by 9k1l4oc8
Wed Dec 11, 2019 2:50 am
Forum: Bare metal, Assembly language
Topic: ARM ASM && printf
Replies: 13
Views: 1398

ARM ASM && printf

I am very new to ARM assembly and I am in the midst of learning this beast. So far it has been very fun, but I have stumbled across a problem that I can't find a fix for google on. I want to use printf() from C to print out some numbers and I go though and solve the Project Euler problems, but I can...
by 9k1l4oc8
Wed Dec 11, 2019 2:41 am
Forum: Bare metal, Assembly language
Topic: Hello world gdb dump questions
Replies: 4
Views: 594

Re: Hello world gdb dump questions

Thank you so much for the response! That helps me understand so many things I did not in assembly. I am starting to learn GDB and need to start doing some of the project Euler problems on my raspberry pi. Again thanks for taking the time to help! A useful hint. When in GDB type "layout reg&quo...
by 9k1l4oc8
Tue Dec 10, 2019 5:58 pm
Forum: Bare metal, Assembly language
Topic: Hello world gdb dump questions
Replies: 4
Views: 594

Re: Hello world gdb dump questions

Here is the dumped code for the hello_world.c program. It's a lot better to post code as text (and inbetween code tags) rather than images as images make life hard to point out sections, we can't copy-paste text out of an image. I just have a couple of questions about what I am seeing. For address ...
by 9k1l4oc8
Mon Dec 09, 2019 2:44 am
Forum: Bare metal, Assembly language
Topic: [Solved] System calls
Replies: 9
Views: 1551

Re: System calls

Thank you everyone! These posts were super helpful and got me what I needed.
by 9k1l4oc8
Mon Dec 09, 2019 2:33 am
Forum: Bare metal, Assembly language
Topic: Hello world gdb dump questions
Replies: 4
Views: 594

Hello world gdb dump questions

Here is the dumped code for the hello_world.c program. https://i.ibb.co/cY3HDzp/gdb-dump-7-22.png https://i.ibb.co/Sc3fLX0/gdb-dump-7-26.png I just have a couple of questions about what I am seeing. For address 0x0001043c should you always push r11 (frame pointer) and the LR to the stack at the begi...
by 9k1l4oc8
Sat Dec 07, 2019 3:49 am
Forum: Bare metal, Assembly language
Topic: [Solved] System calls
Replies: 9
Views: 1551

Re: System calls

I will checkout what you all provided so far, but I am not trying to use the C library if I can go without it.
by 9k1l4oc8
Sat Dec 07, 2019 2:18 am
Forum: Bare metal, Assembly language
Topic: [Solved] System calls
Replies: 9
Views: 1551

[Solved] System calls

I am just starting with ARM assembly and I was wondering how do you know what numbers relate to which systems calls? Correct me please as I make mistakes by the way. It does seem that the instruction SWI calls these system calls, not sure if the instruction name has changed for the PI 3 B+. (Which i...
by 9k1l4oc8
Mon Jan 14, 2019 10:02 pm
Forum: Troubleshooting
Topic: Pi slow to respond to initial connection, fast after
Replies: 7
Views: 757

Re: Pi slow to respond to initial connection, fast after

Its just possible that your router is dropping the connection to your pi as it puts the wifi connection to sleep due to a lack of traffic on the connection, once the connection is established again because there is traffic between the pi and the route the wifi connection remains established. That's...
by 9k1l4oc8
Sun Jan 13, 2019 9:22 pm
Forum: Troubleshooting
Topic: Pi slow to respond to initial connection, fast after
Replies: 7
Views: 757

Re: Pi slow to respond to initial connection, fast after

I've seen similar behaviour caused by DNS name resolution problems. Sometimes nothing happens until some timeout happens then it carries on as normal. If the result is cached locally then next time the timeout doesn't happen. PeterO Well since there is no domain and this is happening just locally o...
by 9k1l4oc8
Sun Jan 13, 2019 8:24 pm
Forum: Troubleshooting
Topic: Pi slow to respond to initial connection, fast after
Replies: 7
Views: 757

Re: Pi slow to respond to initial connection, fast after

Hi. So the first question is how is your pi connected to your network ? I am guessing its wifi connected , I have a pi zero that's like this, but I think its because its on the edge of the wifi range as its out in my garage, if I bring it indoors I have no problem with it. If you can try connecting...
by 9k1l4oc8
Sun Jan 13, 2019 2:01 am
Forum: Troubleshooting
Topic: Pi slow to respond to initial connection, fast after
Replies: 7
Views: 757

Pi slow to respond to initial connection, fast after

Hello everyone, I do believe this is my first post! Raspberry Pi 3B+ is working amazingly with the exception of one thing. Whenever I go to connect to it over the internet or over wifi it lags at first before it connects. Connections after the initial connection are quite quick. I have this issue wi...

Go to advanced search