当前位置: 首页 > news >正文

wordpress 仿雷锋网seo推广多少钱

wordpress 仿雷锋网,seo推广多少钱,自己做的网站邮箱更改密码程序为什么总出错,深圳全网站建设公司【RISC-V设计-14】- RISC-V处理器设计K0A之打印输出 文章目录 【RISC-V设计-14】- RISC-V处理器设计K0A之打印输出1.简介2.验证用例3.软件代码4.链接脚本5.编译脚本6.仿真结果6.1 复位结束6.2 运行成功6.3 终端打印 7.总结 1.简介 本文将详细阐述如何利用 printf 来打印字符串…

【RISC-V设计-14】- RISC-V处理器设计K0A之打印输出

文章目录

  • 【RISC-V设计-14】- RISC-V处理器设计K0A之打印输出
    • 1.简介
    • 2.验证用例
    • 3.软件代码
    • 4.链接脚本
    • 5.编译脚本
    • 6.仿真结果
      • 6.1 复位结束
      • 6.2 运行成功
      • 6.3 终端打印
    • 7.总结

1.简介

本文将详细阐述如何利用 printf 来打印字符串,在此过程中使用了一个开源的库 xprintfxprintf 是一个紧凑的字符串 I/O 库,它非常适用于程序存储器不足以用于常规 printf 函数的微型微控制器。通过调用 xprintf 函数成功输出了“Hello RISC-V World!”,同时还对该库的使用方法以及如何进行编译等内容加以介绍。xprintf库的地址为:http://elm-chan.org/fsw/strf/xprintf.html,下载后使将使用xprintf.cxprintf.h两个文件。

2.验证用例

// -------------------------------------------------------------------------------------------------
// Copyright 2024 Kearn Chen, kearn.chen@aliyun.com
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// -------------------------------------------------------------------------------------------------
// Description :
//             1. Run Hello World!
// -------------------------------------------------------------------------------------------------task initcase;load_instr("hello_world_test/hello_world_test.bin");endtasktask testcase;#2_000_000;endtask

在验证用例中,任务initcase加载Bin文件到仿真模型中,任务testcase延迟2毫秒,等待CPU执行完软件指令。

3.软件代码

// -------------------------------------------------------------------------------------------------
// Copyright 2024 Kearn Chen, kearn.chen@aliyun.com
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// -------------------------------------------------------------------------------------------------#include "xprintf.h"void xfunc_output_callback(int c)
{*((volatile unsigned int *)0xc0000) = c;
}void simulation_finish(void)
{*((volatile unsigned int *)0xc0004) = 0x12345678;
}int main(void)
{xfunc_output = xfunc_output_callback;xprintf("Hello RISC-V World!\n");simulation_finish();while(1);
}

上述代码中,首先是初始化打印输出的回调函数,在回调函数中,将要输出的字符写入地址0xc0000寄存器中,这个寄存器在之前的文章【RISC-V设计-12】- RISC-V处理器设计K0A之验证环境中第4部分有描述,写入此寄存器的数据会存入到一个队列里面,在遇到输出字符为\n时,将整个队列内的输出到终端。在输出完字符后,调用simulation_finish函数,仿真运行结束。在xprintf库中,有一些宏定义,如下所示,根据需要可以打开和关闭。

#define XF_USE_OUTPUT	1	/* 1: Enable output functions */
#define	XF_CRLF			0	/* 1: Convert \n ==> \r\n in the output char */
#define	XF_USE_DUMP		0	/* 1: Enable put_dump function */
#define	XF_USE_LLI		0	/* 1: Enable long long integer in size prefix ll */
#define	XF_USE_FP		0	/* 1: Enable support for floating point in type e and f */
#define XF_DPC			'.'	/* Decimal separator for floating point */
#define XF_USE_INPUT	0	/* 1: Enable input functions */
#define	XF_INPUT_ECHO	0	/* 1: Echo back input chars in xgets function */

4.链接脚本

ENTRY( _start )__stack_size = 2048;PROVIDE( _stack_size = __stack_size );MEMORY
{ROM (rx)  : ORIGIN = 0x00000, LENGTH = 512KRAM (xrw) : ORIGIN = 0x80000, LENGTH = 256K
}SECTIONS
{.init :{_sinit = .;. = ALIGN(4);KEEP(*(SORT_NONE(.init))). = ALIGN(4);_einit = .;} >ROM.text :{. = ALIGN(4);*(.text)*(.text.*)*(.rodata)*(.rodata*)*(.gnu.linkonce.t.*). = ALIGN(4);} >ROM.fini :{KEEP(*(SORT_NONE(.fini))). = ALIGN(4);} >ROMPROVIDE( _etext = . );PROVIDE( _eitcm = . );  .preinit_array :{PROVIDE_HIDDEN (__preinit_array_start = .);KEEP (*(.preinit_array))PROVIDE_HIDDEN (__preinit_array_end = .);} >ROM.init_array :{PROVIDE_HIDDEN (__init_array_start = .);KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))PROVIDE_HIDDEN (__init_array_end = .);} >ROM.fini_array :{PROVIDE_HIDDEN (__fini_array_start = .);KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))PROVIDE_HIDDEN (__fini_array_end = .);} >ROM.ctors :{KEEP (*crtbegin.o(.ctors))KEEP (*crtbegin?.o(.ctors))KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))KEEP (*(SORT(.ctors.*)))KEEP (*(.ctors))} >ROM.dtors :{KEEP (*crtbegin.o(.dtors))KEEP (*crtbegin?.o(.dtors))KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))KEEP (*(SORT(.dtors.*)))KEEP (*(.dtors))} >ROM.dalign :{. = ALIGN(4);PROVIDE(_data_vma = .);} >RAM AT>ROM  .dlalign :{. = ALIGN(4); PROVIDE(_data_lma = .);} >ROM.data :{. = ALIGN(4);*(.gnu.linkonce.r.*)*(.data .data.*)*(.gnu.linkonce.d.*). = ALIGN(8);PROVIDE( __global_pointer$ = . + 0x800 );*(.sdata .sdata.*)*(.sdata2*)*(.gnu.linkonce.s.*). = ALIGN(8);*(.srodata.cst16)*(.srodata.cst8)*(.srodata.cst4)*(.srodata.cst2)*(.srodata .srodata.*). = ALIGN(4);PROVIDE( _edata = .);} >RAM AT>ROM.bss :{. = ALIGN(4);PROVIDE( _sbss = .);*(.sbss*)*(.gnu.linkonce.sb.*)*(.bss*)*(.gnu.linkonce.b.*)    *(COMMON*). = ALIGN(4);PROVIDE( _ebss = .);} >RAM AT>ROMPROVIDE( _end = _ebss);PROVIDE( end = . );.stack ORIGIN(RAM) + LENGTH(RAM) - __stack_size :{PROVIDE( _heap_end = . );. = ALIGN(4);PROVIDE(_susrstack = . );. = . + __stack_size;PROVIDE( _eusrstack = .);} >RAM 
}

5.编译脚本

# -------------------------------------------------------------------------------------------------
# Copyright 2024 Kearn Chen, kearn.chen@aliyun.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------------------------------------PREFIX := riscv-none-embed-LINKER := ../common/link.ldOBJECT += ../common/startup.o
OBJECT += ../common/xprintf.o
OBJECT += main.oCFLAGS := -march=rv32e -mabi=ilp32e -I../commonLFLAGS := -march=rv32e -mabi=ilp32e -T$(LINKER) -nostartfilesTARGET := $(notdir $(shell pwd))all : $(TARGET).asm $(TARGET).bin%.bin : %.elf$(PREFIX)objcopy -Obinary $< $@%.asm : %.elf$(PREFIX)objdump -D $< > $@%.elf : $(OBJECT)$(PREFIX)gcc $(LFLAGS) -o $@ $^$(PREFIX)size $@%.o : %.S$(PREFIX)gcc $(CFLAGS) -c -o $@ $<%.o : %.c$(PREFIX)gcc $(CFLAGS) -c -o $@ $<clean :@rm -rf *.o *.elf *.asm *.bin ../common/*.o.PHONY: clean all.SECONDARY:

上述脚本中所使用的startup.o文件为startup.S文件所编译产生,这个文件在之前的文章【RISC-V设计-09】- RISC-V处理器设计K0A之CIC中第5部分已有介绍,这个文件为RISCV-K0A的启动文件,同时还具有中断处理的功能。编译结果如下

riscv-none-embed-gcc -march=rv32e -mabi=ilp32e -I../common -c -o ../common/startup.o ../common/startup.S
riscv-none-embed-gcc -march=rv32e -mabi=ilp32e -I../common -c -o ../common/xprintf.o ../common/xprintf.c
riscv-none-embed-gcc -march=rv32e -mabi=ilp32e -I../common -c -o main.o main.c
riscv-none-embed-gcc -march=rv32e -mabi=ilp32e -T../common/link.ld -nostartfiles -o hello_world_test.elf ../common/startup.o ../common/xprintf.o main.o
riscv-none-embed-size hello_world_test.elftext	   data	    bss	    dec	    hex	filename3164	      0	   2056	   5220	   1464	hello_world_test.elf
riscv-none-embed-objdump -D hello_world_test.elf > hello_world_test.asm
riscv-none-embed-objcopy -Obinary hello_world_test.elf hello_world_test.bin

6.仿真结果

6.1 复位结束

6.2 运行成功

6.3 终端打印

*Verdi* FSDB WARNING: The FSDB file already exists. Overwriting the FSDB file may crash the programs that are using this file.
*Verdi* : Create FSDB file 'novas.fsdb'
*Verdi* : Begin traversing the scopes, layer (0).
*Verdi* : End of traversing.
[MCU_INFO] : Hello RISC-V World!
$finish called from file "../env/slave_model.v", line 136.
$finish at simulation time                43210

7.总结

本文介绍了如何在RISCV-K0A上使用xprintf库文件,并通过xprintf输出了"Hello RISC-V World!"到终端显示。


文章转载自:
http://dinncomacrame.tqpr.cn
http://dinncokingmaker.tqpr.cn
http://dinncopiezomagnetism.tqpr.cn
http://dinncohypermetrical.tqpr.cn
http://dinncogunther.tqpr.cn
http://dinncosedimentologic.tqpr.cn
http://dinncoibadan.tqpr.cn
http://dinncowove.tqpr.cn
http://dinncoshowgirl.tqpr.cn
http://dinncoarequipa.tqpr.cn
http://dinncoapomictic.tqpr.cn
http://dinncotripy.tqpr.cn
http://dinncoerythrophyll.tqpr.cn
http://dinncoeleatic.tqpr.cn
http://dinncophytobenthon.tqpr.cn
http://dinncooxycarpous.tqpr.cn
http://dinncoasexuality.tqpr.cn
http://dinncopsychodelic.tqpr.cn
http://dinncomassasauga.tqpr.cn
http://dinncodisintoxicate.tqpr.cn
http://dinncomedievalize.tqpr.cn
http://dinncobania.tqpr.cn
http://dinncoadream.tqpr.cn
http://dinncosublimate.tqpr.cn
http://dinncolyons.tqpr.cn
http://dinncomoderato.tqpr.cn
http://dinncounenviable.tqpr.cn
http://dinncoancient.tqpr.cn
http://dinncoantecede.tqpr.cn
http://dinncokeratosulphate.tqpr.cn
http://dinncotoadyism.tqpr.cn
http://dinncosomeone.tqpr.cn
http://dinncosidearm.tqpr.cn
http://dinncowesting.tqpr.cn
http://dinncogeobiology.tqpr.cn
http://dinncopentaprism.tqpr.cn
http://dinncolorn.tqpr.cn
http://dinncosalutatory.tqpr.cn
http://dinncoanodize.tqpr.cn
http://dinncoinflectional.tqpr.cn
http://dinncodulocracy.tqpr.cn
http://dinncoinsouciance.tqpr.cn
http://dinncotrucker.tqpr.cn
http://dinncocoupla.tqpr.cn
http://dinncochromonema.tqpr.cn
http://dinncowindbreak.tqpr.cn
http://dinncounknowing.tqpr.cn
http://dinncolucifugous.tqpr.cn
http://dinncoascensionist.tqpr.cn
http://dinncomisspell.tqpr.cn
http://dinncomorbilli.tqpr.cn
http://dinncotruthlessly.tqpr.cn
http://dinncowell.tqpr.cn
http://dinncoabaptiston.tqpr.cn
http://dinncophilosophy.tqpr.cn
http://dinncognaw.tqpr.cn
http://dinncomudflow.tqpr.cn
http://dinncoem.tqpr.cn
http://dinncoxylidine.tqpr.cn
http://dinncowordiness.tqpr.cn
http://dinncointendant.tqpr.cn
http://dinncobanjax.tqpr.cn
http://dinncowineskin.tqpr.cn
http://dinncoindebted.tqpr.cn
http://dinncobotanical.tqpr.cn
http://dinncobourdon.tqpr.cn
http://dinncowhistly.tqpr.cn
http://dinncocolumniform.tqpr.cn
http://dinncobatiste.tqpr.cn
http://dinncoastrict.tqpr.cn
http://dinncobrantail.tqpr.cn
http://dinncoviolative.tqpr.cn
http://dinncoultrafilter.tqpr.cn
http://dinncounilateralism.tqpr.cn
http://dinncohydroformer.tqpr.cn
http://dinncobraless.tqpr.cn
http://dinncocontrastive.tqpr.cn
http://dinncotour.tqpr.cn
http://dinncomartial.tqpr.cn
http://dinncomuralist.tqpr.cn
http://dinncorelet.tqpr.cn
http://dinncocosmically.tqpr.cn
http://dinncorosy.tqpr.cn
http://dinncoloaf.tqpr.cn
http://dinncominestrone.tqpr.cn
http://dinncoslup.tqpr.cn
http://dinncorashness.tqpr.cn
http://dinnconapoo.tqpr.cn
http://dinncohalley.tqpr.cn
http://dinncocellar.tqpr.cn
http://dinncocowled.tqpr.cn
http://dinncoheatronic.tqpr.cn
http://dinncomiration.tqpr.cn
http://dinncoplenary.tqpr.cn
http://dinncocontinency.tqpr.cn
http://dinncobreaststroke.tqpr.cn
http://dinncoextensible.tqpr.cn
http://dinncoyeoman.tqpr.cn
http://dinncoprogesterone.tqpr.cn
http://dinncolusaka.tqpr.cn
http://www.dinnco.com/news/140778.html

相关文章:

  • 网站免费服务器西安网站定制开发
  • 个人建站软件公司国际热点事件
  • 企业做网站天津seo技术软件
  • 网站外链要怎么做苏州网站建设公司排名
  • 做动态网站必学优化合作平台
  • 泰州网站建设搭建广州优化营商环境条例
  • 一流的网站建设公司黑龙江最新疫情
  • 昆明企业网站建设网络营销的四个策略
  • 里水网站建设2021最新免费的推广引流软件
  • 做一网站需要哪些语言快速提升网站排名
  • 做网站套模板在线crm网站建站
  • 淘宝网店设计制作优化网站关键词
  • 做一个网站怎么做的吗灰色词seo排名
  • 产品开发过程重庆百度快照优化
  • 宝安led行业网站建设seo整站优化新站快速排名
  • java做网站网站优化推广
  • 杭州模板网站建设珠海seo快速排名
  • 互联网网站模块竞价托管哪家专业
  • 中国企业信息网新野seo公司
  • 湖南营销型网站建设 j磐石网络网页设计学生作业模板
  • 江西求做网站宁波seo推荐
  • 梅河口建设局网站河北网站建设公司排名
  • 教学网站二级域名网站免费建站
  • Wordpress搜索指定页面内容温州seo公司
  • 衡水网站制作公司天津关键词优化网排名
  • 呼伦贝尔旅游包车网站咋做百度广告位价格表
  • 网站管理百度手游app下载
  • 深圳网站制作公司嘉兴外贸网站有哪些
  • 合肥最好的网站建设网络推广怎么做方案
  • 南山网站多少钱怎么建立一个网站