分享

Linux 开发常用打印

 charlie_linux 2020-08-30

30     for (i=0; i<33; i++)                                                                                                                                                

 31     {

 32     |   if ((i%16) == 0)

 33     |   { printf("%02d ",i-1);

 34     |   |   printf("\n");}

 35     |  else

 36     |   printf("%02d ",i-1);

 37 ····|···|···|···|···|···|···|···|···|···|···········

 38     }

00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

.PHONY: $(noconfig_targets)

for(i=0;i<16;i++)

{

   libc_printf("-0x%x-",salt_key[i]); 

}

libc_printf("\n %s-%d hmac val is: \n",__FUNCTION__,__LINE__);

    for(i=0;i<32;i++)

{

   libc_printf("-0x%x-",output[i]); 

}

libc_printf("\n");

GEN_HMAC_PRINTF("%s-%d: hamc fixed === === \n",__FUNCTION__,__LINE__);

for (addr = 0; addr <= 0xff; addr ++) {         

     if (!(addr % 4)) {                         

       printf("\n");                          

       printf("0x%08X:", addr * 4);           

     }                                          

     otp_read(addr * 4, &value, 4);             

     printf("%08X ", value);                    

  }                                             

  printf("\nYour otp read end and succeed !\n");

{

UINT8 *buf1 = NULL; 

buf1 = buf;

int i=0;

for (i=0; i<16; i++)

{

       FIXED_PRINTF("%2.2x,",*buf++);

}

buf1 = NULL;

FIXED_PRINTF("\n");

}

把show AV的数据 前面16个 打印出来

if ((i%16) == 0)

FIXED_PRINTF("\n");

else

   FIXED_PRINTF("%02x ",*buf1++);

RET_CODE bl_show_logo(UINT8 *buf, UINT32 len)

{UINT8 *buf1 = NULL; 

buf1 = buf;

for (int i=0; i<16; i++)

{

       FIXED_PRINTF("%2x",*buf++);

}

buf1 = NULL;

}

for(i=0;i<16;i++)

{

   libc_printf("-0x%x-",salt_key[i]); 

}

for(i=0;i<32;i++)

{

   libc_printf("-0x%x-",output[i]); 

}

libc_printf("%d-%s(): 000 True (%x %x %x %x)\n",\

__LINE__, __FUNCTION__, salt_key[0], salt_key[1], salt_key[2], salt_key[3]);

libc_printf("%d-%s(): True (%x %x %x %x)\n",\

__LINE__, __FUNCTION__, output[0], output[1], output[2], output[3]);

libc_printf("%d-%s(): 000 True (%x %x %x %x)\n",\

__LINE__, __FUNCTION__, otp_value[0], otp_value[1], otp_value[2], otp_value[3]);

libc_printf("%d-%s(): True (%x %x %x %x)\n",\

__LINE__, __FUNCTION__, otp_key_value[0], otp_key_value[1], otp_key_value[2], otp_key_value[3]);

@##ifdef的使用和#if defined()的用法一致

\\alinet\tpe\DMS\STB\STB_Project\Fuse_setting\C3503D\OTP Fuse table

OTP路径 原理图。

#undef TEST_A 

#undef TEST_CLASS_A 

#ifndef xxxx

#endif

#ifdef xxxx

#endif

#if defined(xxx)

#endif

#if (xx == 50)||(xx == 20)

#endif

#if defined(CONFIG_CMD_PCI) || defined (CONFIG_PCI)

#endif

#################### dd 命令 ###############

dd if=loader_core.bin of=loader_core2.bin conv=notrunc

把文件loader_core.bin 和loader_core2.bin合并

比如loader_core.bin 有4行

loader_core2.bin 有5行

 loader_core.bin 就会覆盖掉loader_core2.bin的前面4行,保留loader_core2.bin的第5行。  

##########

len=$(stat -c %s u-boot.bin)

padding_len=$((16-($len%16)))

dd if=/dev/zero bs=1 count=$padding_len >> padding.bin

cat u-boot.bin padding.bin > u-boot.bin.tmp

cp u-boot.bin.tmp u-boot.bin

rm padding.bin u-boot.bin.tmp

cat u-boot.bin padding.bin > u-boot.bin.tmp

把u-boot.bin 和 padding.bin 按照先后顺序写入 u-boot.bin.tmp中

cat u-boot.bin padding.bin >> u-boot.bin.tmp

把u-boot.bin 和 padding.bin 按照先后顺序写入 u-boot.bin.tmp中,然后再次写入一次,共两次。

【生成2M全0xff文件】

'\000'是0,'\377'是255,即0-255

tr 命令 替换 把00 替换成 FF

tr '\000' '\377' < /dev/zero | dd of=allones bs=1024 count=2k

echo svvvvvvs > aa.sh 先清空,再写入

echo dsvvvvvvsd >> aa.sh 换行。追加写入

svvvvvvs

dsvvvvvvsd

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多