小编Gre*_*rek的帖子

valgrind无法识别覆盆子Pi中的memcmp指令

我在Valgrind测试我的应用程序,我无法理解为什么它会在这里抛出无法识别的指令错误:

unsigned char *temp=SearchStartPtr;
unsigned char *NrStartPos=NULL;
unsigned char *Param=(unsigned char*)ParamName; //this is originally *char with "PAR#" inside

if(0==memcmp(temp,Param,4)) 
        {
        NrStartPos=temp;
        break;
        }       
Run Code Online (Sandbox Code Playgroud)

Valgrind抛出这个并退出我的应用程序.

disInstr(arm): unhandled instruction: 0xF1010200
cond=15(0xF) 27:20=16(0x10) 4:4=0 3:0=0(0x0)
==7679== valgrind: Unrecognised instruction at address 0x4843588.
==7679==    at 0x4843588: ??? (in /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so)
Your program just tried to execute an instruction that Valgrind
==7679== did not recognise.  There are two possible reasons for this.
==7679== 1. Your program has a bug and erroneously jumped to a non-code
==7679== …
Run Code Online (Sandbox Code Playgroud)

c valgrind raspberry-pi raspbian

13
推荐指数
1
解决办法
4992
查看次数

Raspberry PI,原始读取 C 中的寄存器值

有人可以向我展示一些有关如何从 Raspberry Pi 寄存器读取值的示例吗?我需要检查 AUX_MU_LSR_REG (0x7E21 5054) 中的字节,但我不知道如何在不使用任何其他库的情况下执行此操作。我试图:(在这里我修改了原始帖子)

** * ** * ** * ** * ** * ** * ** * **** *代码开始

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
#include <errno.h>



#define BCM2708     0x20000000
#define UART_BASE   (BCM2708+0x215000)
#define PAGE_SIZE   (4*1024)
#define BLOCK_SIZE  (4*1024)



int mem_fd;                 
void *uart_map;                 
volatile unsigned *uart;            




int main()
{

printf("start\n");

if((mem_fd=open("/dev/mem",O_RDWR|O_SYNC))<0)
{
printf("can't open /dev/mem \n");
exit(-1);
}
else printf("stream_file open OK \n");

if((uart_map=malloc(BLOCK_SIZE))==0)
printf("malloc fail\n");
else printf("GPIO_mallocation OK %d \n", …
Run Code Online (Sandbox Code Playgroud)

c raspberry-pi raspbian

5
推荐指数
1
解决办法
2507
查看次数

标签 统计

c ×2

raspberry-pi ×2

raspbian ×2

valgrind ×1