1 Star 0 Fork 0

枫影的约定 / powershell-flash

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

Powershell模块说明

此模块的功能是进行嵌入式固件的下载。我目前使用的powershell版本为7.2.4。

目前支持的芯片

  • efm32pg12

安装模块

目前模块已经上传到powershellgallery上,所以直接采用powershell的模块安装就好。

Install-Module -Name powershell-flash

module安装路径

然后我们需要在powershell的启动脚本里导入模块。 打开启动脚本:

notepad.exe $Profile

在文件里添加:

Import-Module powershell-flash

module安装路径

通过如下指令测试模块是否安装完成:

Get-Module

module安装路径

更新模块

Update-Module -Name powershell-flash

卸载模块

Uninstall-Module -Name powershell-flash

然后把启动文件里的模块导入去掉。 打开启动脚本:

notepad.exe $Profile

去除模块导入,删除以下行:

Import-Module powershell-flash

模块导出的函数

  • efm_flash: 下载EFMPG12芯片的固件
    • -app_filename: 固件名称(.hex/.bin),固定位置0
    • -boot_filename_hex: boot固件名称,必须是hex格式,只有在app_filename为bin类型时有效,固定位置1,默认值"bootloader.hex"
    • -address: 固件地址,只有在app_filename为bin类型时有效,固定位置2,默认值0x5000
    • -earse_all: 是否全部擦除芯片,只有在app_filename为bin类型时有效,固定位置3,默认值false
  • efm_select_factory: 选择EFMPG12芯片的厂测步骤
  • efm_unlock: 解锁EFMPG12芯片
  • efm_erase_all: EFM32PG12芯片全部擦除

使用方式

以efm32pg12芯片为例:

efm_flash <需要下载固件名称> <需要下载的boot文件(只对bin文件有效,且此文件为hex格式)> <需要下载固件地址(只对bin文件有效)> <是否需要全部擦除(只对bin文件有效)>
efm_select_factory
efm_unlock
efm_erase_all

下载.hex文件:

efm_flash .\openocd\DFV_lock-EFM32x.hex

下载.bin文件:

efm_flash .\factory_mcu_module_application_log_header.bin .\bootload.hex 0x5000

擦除整个芯片后,下载.bin文件:

efm_flash .\factory_mcu_module_application_log_header.bin .\bootload.hex 0x5000 -earse_all

选择厂测步骤

efm_select_factory

解锁芯片

efm_unlock

擦除整个芯片

efm_erase_all

外部依赖

Jlink

我们需要下载jlink,目前我使用的版本为7.54a。 下载jlink: jlink下载

至于jlink的安装,直接通过我们下载的exe安装就好

Simplicity Commander

Simplicity Commander是silabs芯片的下载工具。 下载Simplicity Commander: commander下载 下载完成后将Simplicity Commander解压在一个路径下,然后将这个路经配置到环境变量里: commander配置

推送模块到powershellgallery的指令

测试是否可以提交

Publish-Module `
    -Path <模块路径> `
    -NuGetApiKey <gallerykey> `
    -ProjectUri <项目的git地址> `
    -WhatIf `
    -Verbose

正真提交

Publish-Module `
    -Path <模块路径> `
    -NuGetApiKey <gallerykey> `
    -ProjectUri <项目的git地址> `
    -Verbose
BSD 3-Clause License Copyright (c) 2022, 枫影的约定 All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

通过openocd来进行程序下载的powershell模块 展开 收起
PowerShell
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/wangyan1003/powershell-flash.git
git@gitee.com:wangyan1003/powershell-flash.git
wangyan1003
powershell-flash
powershell-flash
master

搜索帮助