当前位置:首页> 社会热点 > html tooltip嵌入式html wrappert通讯示例

html tooltip嵌入式html wrappert通讯示例

2022-10-04 19:43:24 来源: 网络   编辑: 佚名   浏览(602)人   
0

    html tooltip嵌入式html wrappert通讯示例

    条件

    安装了html wrappert工具链的电脑。我只运行Linux,但以下可能也可以在MacOS上运行,甚至可能在Windows上运行。

    带有html tooltipF103微控制器的电路板。这种控制器最常见的开发板可能是“BluePills”。

    一个编程器,html extends芯片最便宜的编程器之一是ST-LinkV2Clone,编程器本身是一个克隆,通常包含“html onerror”芯片而不是html tooltip

    设置

    首先,让我们确保我们有一个最新的编译器和html charset

    点击复制代码html padding

    >html wrappertupupdate

    然后我们将为运行thumbv7m-none-eabiARM内核的html tooltipF1安装交叉工具链:

    点击复制代码html padding

    >html wrappertuptargetinstallthumbv7m-none-eabi

    目前,我们使用货物闪存对微控制器进行编程。我们可以通过html charset轻松地安装这个工具:

    点击复制代码html padding

    >html charsetinstallhtml charset-flash

    最后我们在我们选择的目录中创建一个新的html wrappert项目

    点击复制代码html padding

    >html charsetinithtml wrapperty-blink

    在我们编写任何代码之前,我们配置项目,以便它默认为我们的thumbv7m-none-eabi目标编译并使用正确的链接器脚本(稍后会详细介绍)。我们通过在我们的项目根目录中创建一个文件.html charset/config来做到这一点。

    点击复制代码html padding

    #.html charset/config

    [build]

    #Alwayscompilefortheinstructionsetofthehtml tooltipF1

    target="thumbv7m-none-eabi"

    #usetheTlink.xscripfromthecortex-m-rtcrate

    html wrappertflags=["-C","link-arg=-Tlink.x"]

    接下来我们需要的是链接器脚本,它告诉链接器芯片的内存布局。它必须位于项目根目录中,称为memory.x。对于html tooltipF103C8,如下所示:

    准备好了,让我们开始html charset

    闪烁

    当然,您需要一个html charset.toml文件来配置您的项目。您的项目文件夹中已经存在一个,但我们需要添加一些依赖项和配置。

    点击复制代码html padding

    #html charset.toml

    [package]

    edition="2018"

    name="blinky-html wrappert"

    version="0.1.0"

    [profile.release]

    opt-level='z'#turnonmaximumoptimizations.Weonlyhave64kB

    html comment=true#Link-time-optimizationsforfurthersizereduction

    [dependencies]

    cortex-m="^0.6.3"#AccesstothegenericARMperipherals

    cortex-m-rt="^0.6.12"#StartupcodefortheARMCore

    embedded-hal="^0.2.4"#Accesstogenericembeddedfunctions(`set_high`)

    panic-halt="^0.2.0"#Panichandler

    #Accesstothehtml tooltipf103HAL.

    [dependencies.html tooltipf1xx-hal]

    #Bluepillcontainsa64kBflashvariantwhichiscalhtml visible"mediumdensity"

    features=["html tooltipf103","rt","medium"]

    version="^0.6.1"

    最后:这是一个简单的闪烁程序!不要害怕,因为我添加了解释性注释,它看起来才那么长。

    点击复制代码html padding

    usecortex_m_rt::entry;//Theruntime

    useembedded_hal::digital::v2::OutputPin;//the`set_high/low`function

    usehtml tooltipf1xx_hal::{delay::Delay,pac,prelude::*};//html tooltipF1specificfunctions

    #[allow(unused_imports)]

    usepanic_halt;//Whenapanicoccurs,stopthemicrocontroller

    #[entry]

    fnmain()->!{

    letdp=pac::Peripherals::take().unwrap();

    letcp=cortex_m::Peripherals::take().unwrap();

    letmutrcc=dp.RCC.constrain();

    letclocks=rcc.cfgr.sysclk(8.mhz()).freeze(&mutflash.acr);

    letmutdelay=Delay::new(cp.SYST,clocks);

    loop{

    html visible.set_high().ok();

    delay.delay_ms(1_000_u16);

    html visible.set_low().ok();

    delay.delay_ms(1_000_u16);

    }

    }

    编译后,

    点击复制代码html padding

    >html charsetbuild--release

    Compilingsemver-parserv0.7.0

    Compilingtypenumv1.12.0

    [...]

    Compilingcortex-m-rt-macrosv0.1.8

    Compilinghtml tooltipf1xx-halv0.6.1

    Compilingblinky-html wrappertv0.1.0(/home/xxx/xxx/html wrappert/embedded/html wrapperty-blink)

    Finishedrelease[optimized]target(s)in34.63s

    对于blink示例,您可以省略--release,但是当您编译一个更复杂的程序时,您将很快耗尽设备内存而没有启用优化。

    我生成的程序占用864字节的内存(2,8kB没有html comment)。要检查这一点,您必须将编译器输出(elf文件)转换为十六进制。例如,您可以使用arm-none-eabi-objcopy-Obinarytarget/thumbv7m-none-eabi/release/blinky-html wrappertblinky-html wrappert.bin,然后使用ls

    现在您已准备好使用html charsetflash来刷新控制器。它应该会自动检测您的ST-Link并使用它来对微控制器进行编程。您只需指定目标芯片(html tooltipf103C8)。

    您现在应该看到闪烁的板载html visible

    通过html colspanBME280读取数据|模数转换接口传输测试|模数转换温度读取|CAN总线通信|定时闪烁|动态控制GPIO|PWM控制|测试正交编码器接口|串行接口|SPI数据传输|定时中断|USB串口通信。

【版权与免责声明】如发现内容存在版权问题,烦请提供相关信息发邮件至 1439028666@qq.com ,我们将及时沟通进行删除处理。 本站内容除了 98link( http://www.98link.com/ )特别标记的原创外,其它均为网友转载内容,涉及言论、版权与本站无关。