I'm trying to encrypt an images for ZCU-104. I follow this guide :
generate RSA keys:
bootgen -p zcu9eg -arch zynqmp -w on -log error -image ./stage1.bif -generate_keys pem
generate SHA3 digest:
bootgen -p zcu9eg -arch zynqmp -w on -log error -image ./stage2.bif
-efuseppkbits ./ppk0_digest.txt
generate keys for all components:
bootgen -p zcu9eg -arch zynqmp -w on -log error -image ./stage3.bif
pass PUF Registration (guide, card output) and create helperdata.txt, black_key.txt, black_iv.txt
generate final BOOT.BIN:
bootgen -p zcu9eg -arch zynqmp -image ./stage4.bif -w -o BOOT.BIN
-encryption_dump
And here I receive an error:
****** Xilinx Bootgen v2020.2
**** Build date : May 27 2021-14:58:44
** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.
[ERROR] : Invalid no. of data bytes for PUF Helper Data.
Expected length for PUF Helper Data is 1544 bytes
and question is how to fix this error?
Vitis version 2022.1, Petalinux version 2022.1. Final bif-file (stage4.bif):
the_ROM_image:
{
[pskfile] psk0.pem
[sskfile] ssk0.pem
[auth_params] spk_id=0; ppk_select=0
[keysrc_encryption] bh_blk_key
[bh_key_iv] black_iv.txt
[bh_keyfile] black_key.txt
[puf_file] helperdata.txt
[fsbl_config] bh_auth_enable,opt_key,puf4kmode,shutter=0x0100005E,pufhd_bh
[bootloader, destination_cpu=a53-0,authentication=rsa,exception_level=el-3, encryption=aes, aeskeyfile=zynqmp_fsbl.nky, blocks=1728(*)] zynqmp_fsbl.elf
[destination_cpu=pmu,authentication=rsa, encryption=aes, aeskeyfile=pmufw.nky, blocks=1728(*)] pmufw.elf
[destination_device=pl,authentication=rsa, encryption=aes, aeskeyfile=system.nky, blocks=1728(*)] system.bit
[destination_cpu=a53-0, exception_level=el-3, trustzone,authentication=rsa] bl31.elf
[destination_cpu=a53-0, exception_level=el-2,authentication=rsa] u-boot.elf
[load=0x1000000, destination_cpu=a53-0,authentication=rsa] image.ub
}
Thank you
Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 months ago.
Improve this question
I'm trying to configure a Debian 11 Virtual Machine (Gen 2) Network in Hyper-V with a PowerShell Script. It uses Linux Integration Services (LIS) and Hyper-V Daemon to allow the Virtual Machine communicate with Hyper-V.
What I have done and general specifications
I make sure to have installed both and have Key-Value Pair Exchange Enabled.
Install init-system-helpers libc6 lsb-base packages installed in my Debian.
The script provided only runs on Windows PowerShell. PowerShell 7 don't have .GetRelated() method.
I'm running Hyper-V on Windows 11
Steps to reproduce the Error
Run Get-VMNetworkAdapter -VMName debian-vm | Set-VMNetworkConfiguration -IPAddress 192.168.1.23 -Subnet 255.255.255.0 -DNSServer 8.8.8.8 -DefaultGateway 192.168.1.1
I get a response with the same info: Msvm_Error Value --> 15090: failed to modify resources
I inspect the VM: tail /var/log/syslog and it showed the following error...
test KVP: Failed to execute cmd '/usr/libexec/hypervkvpd/hv_set_ifconfig /var/lib/hyperv/ifcfg-eth0'; error: 2 No such file or directory
I look info on blogs and some said sometimes the file hv_set_ifconfig was in other location, but I search in the whole system and there was no such as file anywhere.
I appreciate any help with this. Below I leave the function I use when trying to config the IP. Thank you!
Function Set-VMNetworkConfiguration {
[CmdletBinding()]
Param (
[Parameter(Mandatory=$true,
Position=1,
ParameterSetName='DHCP',
ValueFromPipeline=$true)]
[Parameter(Mandatory=$true,
Position=0,
ParameterSetName='Static',
ValueFromPipeline=$true)]
[Microsoft.HyperV.PowerShell.VMNetworkAdapter]$NetworkAdapter,
[Parameter(Mandatory=$true,
Position=1,
ParameterSetName='Static')]
[String[]]$IPAddress=#(),
[Parameter(Mandatory=$false,
Position=2,
ParameterSetName='Static')]
[String[]]$Subnet=#(),
[Parameter(Mandatory=$false,
Position=3,
ParameterSetName='Static')]
[String[]]$DefaultGateway = #(),
[Parameter(Mandatory=$false,
Position=4,
ParameterSetName='Static')]
[String[]]$DNSServer = #(),
[Parameter(Mandatory=$false,
Position=0,
ParameterSetName='DHCP')]
[Switch]$Dhcp
)
$VM = Get-WmiObject -Namespace 'root\virtualization\v2' -Class 'Msvm_ComputerSystem' | Where-Object { $_.ElementName -eq $NetworkAdapter.VMName }
$VMSettings = $vm.GetRelated('Msvm_VirtualSystemSettingData') | Where-Object { $_.VirtualSystemType -eq 'Microsoft:Hyper-V:System:Realized' }
$VMNetAdapters = $VMSettings.GetRelated('Msvm_SyntheticEthernetPortSettingData')
$NetworkSettings = #()
foreach ($NetAdapter in $VMNetAdapters) {
if ($NetAdapter.Address -eq $NetworkAdapter.MacAddress) {
$NetworkSettings = $NetworkSettings + $NetAdapter.GetRelated("Msvm_GuestNetworkAdapterConfiguration")
}
}
$NetworkSettings[0].IPAddresses = $IPAddress
$NetworkSettings[0].Subnets = $Subnet
$NetworkSettings[0].DefaultGateways = $DefaultGateway
$NetworkSettings[0].DNSServers = $DNSServer
$NetworkSettings[0].ProtocolIFType = 4096
if ($dhcp) {
$NetworkSettings[0].DHCPEnabled = $true
} else {
$NetworkSettings[0].DHCPEnabled = $false
}
$Service = Get-WmiObject -Class "Msvm_VirtualSystemManagementService" -Namespace "root\virtualization\v2"
$setIP = $Service.SetGuestNetworkAdapterConfiguration($VM, $NetworkSettings[0].GetText(1))
if ($setip.ReturnValue -eq 4096) {
$job=[WMI]$setip.job
while ($job.JobState -eq 3 -or $job.JobState -eq 4) {
start-sleep 1
$job=[WMI]$setip.job
}
if ($job.JobState -eq 7) {
write-host "Success"
}
else {
$job.GetError()
}
} elseif($setip.ReturnValue -eq 0) {
Write-Host "Success"
}
}
I believe this is the same problem that I experienced on Ubuntu 22.04. Everything was working fine on earlier versions of Ubuntu. This was my fix.
sudo ln -s /usr/sbin /usr/libexec/hypervkvpd
Issue is present on U20, I resolved by running the following commands as root:
# mkdir /usr/libexec/hypervkvpd/
# ln -s /usr/sbin/hv_get_dhcp_info /usr/libexec/hypervkvpd/hv_get_dhcp_info
# ln -s /usr/sbin/hv_get_dns_info /usr/libexec/hypervkvpd/hv_get_dns_inf
Full system details for my U20 build are as follows:
# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.3 LTS"
# uname -a
Linux <hostname> 5.15.0-1022-azure #27~20.04.1-Ubuntu SMP Mon Oct 17 02:03:50 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Referenced the following bug report to identify the issue - https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1766857
I am following this guide to run my C++ code in micropython environment, the normal/simple C++ code works on my ESP32 board but when i try running big loops it gives an error.
The error:
$ picocom -b 115200 /dev/ttyUSB0
picocom v3.1
port is : /dev/ttyUSB0
flowcontrol : none
baudrate is : 115200
parity is : none
databits are : 8
stopbits are : 1
escape is : C-a
local echo is : no
noinit is : no
noreset is : no
hangup is : no
nolock is : no
send_cmd is : sz -vv
receive_cmd is : rz -vv -E
imap is :
omap is :
emap is : crcrlf,delbs,
logfile is : none
initstring : none
exit_after is : not set
exit is : no
Type [C-a] [C-h] to see available commands
Terminal ready
>>> import cppexample
>>> cppexample.cppfunc()
abort() was called at PC 0x402acc26 on core 0
Backtrace:0x400912c6:0x3ffce1c0 0x40091989:0x3ffce1e0 0x400956ae:0x3ffce200 0x402acc26:0x3ffce270 0x40396985:0x3ffce290 0x40396ac5:0x3ffce2b0 0x400d3d73:0x3ffce2d0 0x400d4f53:0x3ffce390 0x402a7d26:0x3ffce3d0 0x402af51d:0x3ffce680 0x402b55f9:0x3ffce6a0 0x402b5726:0x3ffce6c0 0x402b77e1:0x3ffce6e0 0x402af6f0:0x3ffce780 0x402b55f9:0x3ffce7d0 0x402b5622:0x3ffce7f0 0x402e1847:0x3ffce810 0x402e1b99:0x3ffce8a0 0x402c69b0:0x3ffce8e0
ELF file SHA256: fe8de9466e5c428e
Rebooting...
ets Jul 29 2019 12:21:46
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4
load:0x3fff0034,len:5572
load:0x40078000,len:12696
load:0x40080400,len:4292
entry 0x40080414
MicroPython v1.16-243-g8c4ba575f-dirty on 2021-09-20; ESP32 module with ESP32
Type "help()" for more information.
>>>
I got no idea what's happening,any help is appreciated
After upgrading my host PC to a newer Linux version, I can't run my project anymore. I just want to program a copy of a working electronic board : hardware and code have been validated before.
More accurately, the code crashes in the startup script at _libc_init_array and jump either to BusFault_Handler() or HardFault_Handler().
I have read a lot on the forum, and it seems is related to linking to the wrong libc flavor (Thumb vs. ARM).
Tools :
code generation : STM32CubeMX
compiler : GNU GCC version 8.2.1 (8-2018-q4-major)
IDE : Qt Creator
build system : Qbs (Qt's tool)
The MCU is a STM32L476RG, Cortex-M4, ARM v7e-m, with FPU. In GNU GCC installation folder, share/doc/gcc-arm-none-eabi/readme.txt tells me what flags I need :
|------------|--------------------------------------------|--------------|
| Cortex-M4 | -mthumb -mcpu=cortex-m4 -mfloat-abi=softfp | thumb |
| (Soft FP) | -mfpu=fpv4-sp-d16 | /v7e-m+fp |
| |--------------------------------------------| /softfp |
| | -mthumb -march=armv7e-m -mfloat-abi=softfp | |
| | -mfpu=fpv4-sp-d16 | |
|------------|--------------------------------------------|--------------|
| Cortex-M4 | -mthumb -mcpu=cortex-m4 -mfloat-abi=hard | thumb |
| (Hard FP) | -mfpu=fpv4-sp-d16 | /v7e-m+fp |
| |--------------------------------------------| /hard |
| | -mthumb -march=armv7e-m -mfloat-abi=hard | |
| | -mfpu=fpv4-sp-d16 | |
|------------|--------------------------------------------|--------------|
Only -mfloat-abi=softfp works, not -mfloat-abi=hard, but GCC documentation suggests the result is the same ; only calling conventions differ.
Here is my Qbs file :
import qbs
CppApplication {
consoleApplication: true
property string family: "STM32L4xx"
property string linkerScript: "STM32L476RGTx_FLASH.ld"
cpp.positionIndependentCode: false // make sure option -fPIC is not passed to GCC
cpp.defines: [
"USE_HAL_DRIVER",
"STM32L476xx",
"__weak=__attribute__((weak))",
"__packed=__attribute__((__packed__))"
]
cpp.commonCompilerFlags: [
"-fno-common",
"-specs=nosys.specs",
"-specs=nano.specs",
"-march=armv7e-m",
"-mcpu=cortex-m4",
"-mthumb-interwork", // support ARM and Thumb instruction sets
"-mthumb",
"-mfloat-abi=softfp",
"-mfpu=fpv4-sp-d16",
"-mtune=cortex-m4", // tune performance of code for this processor
// "-std=c99",
"-ffunction-sections",
"-fdata-sections",
// "-Os",
"-O0",
"-g3",
"-Wall",
"-c", // don't run the linker
// "-v" // print a lot of details (too much ?)
]
cpp.linkerFlags: [
"-T"+path+"/"+linkerScript,
"--gc-sections", // fixes "undefined reference to _exit" error
"-Map="+buildDirectory+"/memory.map", // file created at the end of the link step
"-static",
"--verbose", // displays library search
// "-lgcc",
// "-lg",
// "-lm"
]
cpp.includePaths: [
"Inc",
"Drivers/CMSIS/Include",
"Drivers/CMSIS/Device/ST/"+family+"/Include",
"Drivers/STM32L4xx_HAL_Driver/Inc",
"Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc",
"Middlewares/ST/STM32_USB_Device_Library/Core/Inc/"
]
files: [
"Inc/*.h",
linkerScript,
"Src/*.c",
"Drivers/CMSIS/Device/ST/"+family+"/Include/*.h",
"Drivers/CMSIS/Device/ST/"+family+"/Source/Templates/gcc/*.s",
"Drivers/CMSIS/Device/ST/"+family+"/Source/Templates/*.c",
"Drivers/CMSIS/Include/*.h",
"Drivers/"+family+"_HAL_Driver/Inc/*.h",
"Drivers/"+family+"_HAL_Driver/Src/*.c",
"Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/*.c",
"Middlewares/ST/STM32_USB_Device_Library/Core/Src/*.c"
]
Properties {
condition: qbs.buildVariant === "debug"
cpp.defines: outer.concat(["DEBUG=1"])
}
Group { // Properties for the produced executable
fileTagsFilter: product.type
qbs.install: true
}
}
The linker --verbose option lets it print the full path of the libraries it links to. And it always resolves to arm-none-eabi/lib/libc.a. But I would have expected arm-none-eabi/lib/thumb/v7e-m+fp/softfp/libc.a instead.
I also tried the linker option -nostdlib in conjunction with the -L flag , but it has no effect. It compiles even when I omit -L, but according to GCC man page, it shouldn't.
So, I am pretty stuck here. That 5 minute work is turning into days...
The problem was that the newer version of Qbs I got (v1.12.1) is smart enough to prepend "-Wl," to all options under cpp.linkerFlags... The solution is to set those flags needed to compile AND link in a cpp.driverFlags section.
Should it be helpful to anyone, here is my working (to date ;-) ) Qbs file.
import qbs
CppApplication {
consoleApplication: true
property string family: "STM32L4xx"
property string linkerScript: "STM32L476RGTx_FLASH.ld"
cpp.positionIndependentCode: false // make sure option -fPIC is not passed to GCC
// Make sure to call the linker through GCC driver :
cpp.linkerMode: "manual" // default : "automatic"
cpp.linkerName: "gcc" // this string is appended to "<full_path_to_toolchain>/arm-none-eabi-"
// Define some symbols (GCC -D flag)
cpp.defines: [
"USE_HAL_DRIVER",
"STM32L476xx",
"__weak=__attribute__((weak))",
"__packed=__attribute__((__packed__))"
]
// Options for compilation AND linking.
cpp.driverFlags: [
// CPU
"-mcpu=cortex-m4",
"-mthumb",
"-mfpu=fpv4-sp-d16",
"-mfloat-abi=hard",
"-specs=nano.specs", // use smaller libc
]
// Compiler flags for all langages (C, C++).
cpp.commonCompilerFlags: [
// Optimizations
//"-Os",
//"-O0",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
// For debug
"-g",
"-gdwarf-2",
"-c", // don't run the linker
//"-v" // print a whole lot of details
]
// Linker flag only i.e. understood by LD !!!
// Qbs will prepend all these flags with "-Wl," so that GCC transfers them to LD.
// Other options required for linking should be set in the driverFlags section.
cpp.linkerFlags: [
"-T"+path+"/"+linkerScript,
"-static",
"--verbose", // displays library search
"-lc",
"-lm",
"-lnosys",
"-Map="+buildDirectory+"/memory.map", // file created at the end of the link step
"--cref", // map file formatting
"--gc-sections", // enables garbage collection for unused sections
]
// Include directories.
cpp.includePaths: [
"Inc",
"Drivers/CMSIS/Include",
"Drivers/CMSIS/Device/ST/"+family+"/Include",
"Drivers/STM32L4xx_HAL_Driver/Inc",
"Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc",
"Middlewares/ST/STM32_USB_Device_Library/Core/Inc/"
]
// Source files.
files: [
"Inc/*.h",
linkerScript,
"Src/*.c",
"Drivers/CMSIS/Device/ST/"+family+"/Include/*.h",
"startup/*.s",
"Drivers/CMSIS/Device/ST/"+family+"/Source/Templates/*.c",
"Drivers/CMSIS/Include/*.h",
"Drivers/"+family+"_HAL_Driver/Inc/*.h",
"Drivers/"+family+"_HAL_Driver/Src/*.c",
"Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/*.c",
"Middlewares/ST/STM32_USB_Device_Library/Core/Src/*.c"
]
Properties {
condition: qbs.buildVariant === "debug"
cpp.defines: outer.concat(["DEBUG=1"])
}
Group { // Properties for the produced executable
fileTagsFilter: product.type
qbs.install: true
}
}
So I have this very simple script which just tries to create a text file and then read it.
version: 1.0.{build}-{branch}
shallow_clone: true
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
TOOLSET: msvc-14.1
ARCH: x86_64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
TOOLSET: msvc-14.1
ARCH: x86
install:
- if %ARCH% == x86 ( set TRIPLET=x86-windows ) else ( set TRIPLET=x64-windows )
- if %ARCH% == x86 ( set AM=32 ) else ( set AM=64 )
- git clone -b master --depth 1 https://github.com/boostorg/boost.git boost-root
- cd boost-root
build: off
test_script:
- set PATH=%ADDPATH%%PATH%
- |-
set VCPKG=%APPVEYOR_BUILD_FOLDER%\..\vcpkg\installed\%TRIPLET%
set "CHUNK=^<include^>%VCPKG%\include ^<search^>%VCPKG%\lib"
echo using zlib : : %CHUNK% ; > config.jam
echo using libjpeg : : %CHUNK% ; >> config.jam
echo using libpng : : ^<name^>libpng16 %CHUNK% ; >> config.jam
echo using libtiff : : %CHUNK% ; >> config.jam
more config.jam
When I run it I get the following error:
Cannot access file C:\projects\gil\boost-root\config.jam
Command exited with code 1
Is there something obviously wrong that I'm missing?
I think set "CHUNK=^<include^>%VCPKG%\include ^<search^>%VCPKG%\lib" breaks something in environment variables. Try moving first " after =, like set CHUNK="^<include^>%VCPKG%\include ^<search^>%VCPKG%\lib".