Я работал над этой программой несколько месяцев и исправил множество ошибок, ошибок с выравниванием и других ошибок сегментации, и я добрался до этой, где при попытке сегментации выдается ошибка сегментации. откройте /dev/mem, я вижу ошибку «Не удалось получить дескриптор файла для /dev/mem», которую я сделал для этой цели в файле elf, я не знаю почему, все параметры кажутся правильными, Кстати, я использую Raspbian, есть идеи?
.include "fileMacros.s"
.equ prot_read, 1
.equ prot_write, 2
.equ map_shared, 1
.equ pageLength, 4096
.equ setregoffset, 28
.equ clrregoffset, 40
/* mmap creates a virtual page of memory in a specified, or non specified
directory, with a varible page size/length for the page created, then returns
a virtual address for the virtual page created */
.macro mmapdevmem
openat devmem, readwrite+execute, stdin
b1:
adds x4, xzr, x0 /* mov devmem file descriptor into x4 */
/* Error handling code */
bpl 1f
mov x1, #1
ldr x2, =devmemerrmessage
ldr w2, [x2]
mov x8, #0x40
svc 0
mov x0, #2
mov x8, #0x5d
svc 0
1:
ldr x5, =gpioBaseAddress/* Load the base gpio address into x5 */
ldr x5, [x5] /* Load the value from the base gpio address */
mov x0, #0 /* move 0 into x0 for stdin */
mov x1, #pageLength /* move 4096 which is the page length into x1 */
mov x2, #3 /* move protect read, and protect write permissions into x2 */
mov x3, #map_shared /* move the map shared value into x3, which is 1 */
mov x8, #0xde /* load the value for the mmap syscall into x8 */
svc 0 /* call mmap */
adds x9, xzr, x0 /* Obtain file descriptor returned from mmap */
bpl 2f
mov x1, #1
write x1, errmessage, len
2:
/* x0 = 0
x1 = 4096
x2 = 3
x3 = 1
x4 = fd for /dev/mem
x5 = value in baseGpioAddress
x8 = 0xde / mmap
x9 = mmap returned file descriptor */
.endm
.macro nanosleep
ldr x0, =timeamount
ldr x1, =timeamount
mov x8, #0x65
svc 0
.endm
.macro gpiodirectionout pin
ldr x2, =\pin /* Load the pin number into x2 */
ldr w2, [x2] /* Load the value of that pin number into x2 */
ldr w1, [x9, x2]/* Load into x1 the value of the file descriptor of mmap offset by the value of the pin that you're trying to set */
ldr x3, =\pin /* Load the pin number into x3 */
add x3, x3, #4 /* add the amount to shift to the pin number */
ldr x3, [x3] /* Load the value of the shift amount of the pin into x3 */
mov x0, #0b111 /* Load 3 1 bits (which is the clear value) into x0 */
lsl x0, x0, x3 /* Shift the 3 1 bits by the pin shift amount */
bic x1, x1, x0 /* Use the 3 bits to clear the mmap offset file descriptor value */
mov x0, #1 /* Move 1 into x0 for the out value */
lsl x0, x0, x3 /* Shift the out bit by the pin shift amount */
orr x1, x1, x0 /* orr the out bit with the mmap file descriptor pin offset value */
str w1, [x9, x2]/* store the out bit into the mmap file descriptor pin offset */
.endm
.macro gpioturnon pin
mov x2, x9
add x2, x2, #setregoffset
mov x0, #1
ldr x3, =\pin
add x3, x3, #8
ldr x3, [x3]
lsl x0, x0, x3
str w0, [x2]
.endm
.macro gpioturnoff pin
mov x2, x9
add x2, x2, #clrregoffset
mov x0, #1
ldr x3, =\pin
add x3, x3, #8
ldr w3, [x3]
lsl x0, x0, x3
str w0, [x2]
.endm
.data
devmem:
.asciz "/dev/mem"
timeamount:
.dword 0
timeremaining:
.dword 10000000
gpioBaseAddress:
.dword 0xfe200000
errmessage:
.asciz "Couldn't obtain file descriptor for /dev/mem\n"
len = .-errmessage
devmemerrmessage:
.asciz "Couldn't obtain devmem file descriptor\n"
len2 = .-devmemerrmessage
//gpio macro file
Я пропустил его через GDB, и он говорит, что ошибка сегментации происходит по адресу 0x0000000000410100, когда я делаю его objdump и перехожу к 410100, это выглядит так: 000a0058 210a0058 c24680d2 030080d2, кроме этого , это все, что мне удалось получить.
Я работал над этой программой несколько месяцев и исправил множество ошибок, ошибок с выравниванием и других ошибок сегментации, и я добрался до этой, где при попытке сегментации выдается ошибка сегментации. откройте /dev/mem, я вижу ошибку «Не удалось получить дескриптор файла для /dev/mem», которую я сделал для этой цели в файле elf, я не знаю почему, все параметры кажутся правильными, Кстати, я использую Raspbian, есть идеи? [code].text .include "gpioLedMacros.s"
/* mmap creates a virtual page of memory in a specified, or non specified directory, with a varible page size/length for the page created, then returns a virtual address for the virtual page created */ .macro mmapdevmem openat devmem, readwrite+execute, stdin b1: adds x4, xzr, x0 /* mov devmem file descriptor into x4 */ /* Error handling code */ bpl 1f mov x1, #1 ldr x2, =devmemerrmessage ldr w2, [x2] mov x8, #0x40 svc 0 mov x0, #2 mov x8, #0x5d svc 0 1: ldr x5, =gpioBaseAddress/* Load the base gpio address into x5 */ ldr x5, [x5] /* Load the value from the base gpio address */ mov x0, #0 /* move 0 into x0 for stdin */ mov x1, #pageLength /* move 4096 which is the page length into x1 */ mov x2, #3 /* move protect read, and protect write permissions into x2 */ mov x3, #map_shared /* move the map shared value into x3, which is 1 */ mov x8, #0xde /* load the value for the mmap syscall into x8 */ svc 0 /* call mmap */ adds x9, xzr, x0 /* Obtain file descriptor returned from mmap */ bpl 2f mov x1, #1 write x1, errmessage, len 2: /* x0 = 0 x1 = 4096 x2 = 3 x3 = 1 x4 = fd for /dev/mem x5 = value in baseGpioAddress x8 = 0xde / mmap x9 = mmap returned file descriptor */ .endm
.macro gpiodirectionout pin ldr x2, =\pin /* Load the pin number into x2 */ ldr w2, [x2] /* Load the value of that pin number into x2 */ ldr w1, [x9, x2]/* Load into x1 the value of the file descriptor of mmap offset by the value of the pin that you're trying to set */ ldr x3, =\pin /* Load the pin number into x3 */ add x3, x3, #4 /* add the amount to shift to the pin number */ ldr x3, [x3] /* Load the value of the shift amount of the pin into x3 */ mov x0, #0b111 /* Load 3 1 bits (which is the clear value) into x0 */ lsl x0, x0, x3 /* Shift the 3 1 bits by the pin shift amount */ bic x1, x1, x0 /* Use the 3 bits to clear the mmap offset file descriptor value */ mov x0, #1 /* Move 1 into x0 for the out value */ lsl x0, x0, x3 /* Shift the out bit by the pin shift amount */ orr x1, x1, x0 /* orr the out bit with the mmap file descriptor pin offset value */ str w1, [x9, x2]/* store the out bit into the mmap file descriptor pin offset */ .endm
.macro close fd mov x0, \fd mov x8, #0x39 svc 0 .endm // File macro file [/code] Я пропустил его через GDB, и он говорит, что ошибка сегментации происходит по адресу 0x0000000000410100, когда я делаю его objdump и перехожу к 410100, это выглядит так: 000a0058 210a0058 c24680d2 030080d2, кроме этого , это все, что мне удалось получить.
вот мой скрипт Python, который я хочу запустить @reboot. Для этого я создал сервис, используя systemd:
`
import vlc
import time
import board
from time import strftime
from PIL import Image, ImageDraw, ImageFont
import configparser
import RPi.GPIO...
вот мой скрипт Python, который я хочу запустить @reboot. Для этого я создал сервис, используя systemd:
import vlc
import time
import board
from time import strftime
from PIL import Image, ImageDraw, ImageFont
import configparser
import RPi.GPIO as...
В настоящее время я работаю над проектом Petalinux, в котором пытаюсь читать/записывать данные из /dev/mem, фактически подключенного к двум модулям BRAM.
Я использую клиентскую библиотеку Google Cloud Storage, специально для Java, для одновременной загрузки всего содержимого корзины с помощью кода, взятого из документации. К сожалению, я получаю сообщение об ошибке «FAILED_TO_START» с сообщением...
Я хочу опубликовать сообщение в blogger с помощью python с API blogger, но не могу, я потратил 24 часа и все еще не могу заставить его работать, это код
import os
import google.auth
import google_auth_oauthlib.flow
import googleapiclient.discovery...