【嵌入式】hi3519av100 关于himm命令找不到的问题

问题描述

自行编译生成的文件系统,在/bin目录下没有himm程序,导致在运行GPIO示例程序中涉及函数system()调用himm命令时提示命令找不到。

解决(定位到海思SDK源码目录:Hi3519AV100_SDK_V2.0.1.0/osdrv/tools/board/reg-tools-1.0.0)

这里面是操作寄存器的源码实现,生成可执行程序btools

himm命令其实只是btools的一个软链接,但btools里面也包含有himm的具体实现。

相关的源码有btools.c   hiddrs.c   hii2c.c    hil2s.c    himc.c     himd.c     himm.c     hivd.c     i2c_ops.c  ssp_rw.c

其他源码作用暂不了解。

/******************************************************************************

  Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd.

 ******************************************************************************
 File Name     : himd.c //错误,应该是himm.c
Version       : Initial Draft
Author        : Hisilicon multimedia software group
Created       : 2005/7/1
Last Modified :
Description   : HI Memory Modify
Function List :
History       :
1.Date        : 2005/7/27
Author      : T41030
Modification: Created file

 ******************************************************************************/

#include 
#include 
#include 
#include "memmap.h"
#include "hi.h"
#include "strfunc.h"

#ifdef __cplusplus
#if __cplusplus
extern "C"{
#endif
#endif /* __cplusplus */

#define DEFAULT_MD_LEN 128

HI_RET himm(int argc , char* argv[])
{
	unsigned long ulAddr = 0;
	unsigned long ulOld, ulNew;
	char strNew[16];
	VOID* pMem  = NULL;

	if (argc <= 1)
	{
		printf("usage: %s 
. sample: %s 0x80040000 0x123\n", argv[0], argv[0]); EXIT("", -1); } if (argc == 2) { if( StrToNumber(argv[1], &ulAddr) == HI_SUCCESS) { printf("====dump memory %#lX====\n", ulAddr); #ifdef PC_EMULATOR #define SHAREFILE "../shm" printf("**** is Emulator, use share file : %s ****\n", SHAREFILE); pMem = mmapfile(SHAREFILE , DEFAULT_MD_LEN); if (NULL == pMem) { EXIT("Memory Map error.", -1); } pMem += ulAddr; #else pMem = memmap(ulAddr, DEFAULT_MD_LEN); if (pMem == NULL) { printf("memmap failed!\n"); return -1; } #endif ulOld = *(unsigned int*)pMem; /*hi_hexdump(STDOUT, pMem, DEFAULT_MD_LEN, 16);*/ printf("%s: 0x%08lX\n", argv[1], ulOld); printf("NewValue:"); scanf("%s", strNew); if (StrToNumber(strNew, &ulNew) == HI_SUCCESS) { *(unsigned int*)pMem = ulNew; } else { printf("Input Error\n"); } } else { printf("Please input address like 0x12345\n"); } } else if (argc == 3) { if( StrToNumber(argv[1], &ulAddr) == HI_SUCCESS && StrToNumber(argv[2], &ulNew) == HI_SUCCESS) { pMem = memmap(ulAddr, DEFAULT_MD_LEN); ulOld = *(unsigned int*)pMem; /*hi_hexdump(STDOUT, pMem, DEFAULT_MD_LEN, 16);*/ printf("%s: 0x%08lX --> 0x%08lX \n", argv[1], ulOld, ulNew); *(unsigned int*)pMem = ulNew; } } else { printf("xxx\n"); } return 0; } #ifdef __cplusplus #if __cplusplus } #endif #endif /* __cplusplus */

 

你可能感兴趣的:(嵌入式)