Binary Utilities -> Create hex in MCUXpresso results in kStatus_FlashAlignmentError FRDM-MCXN947 Error using blhost with generated Post-build hex file We have two Post-build steps to generate bin and hex versions of our firmware using MCUXpresso. The following shows our Post-build steps: arm-none-eabi-size "${BuildArtifactFileName}" arm-none-eabi-objcopy -v -O ihex "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.hex" arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin" Also, I have used the method of right-clicking on the axf file in MCUXpresso and selecting Binary Utilities -> Create hex to generate the hex file. I am trying to use blhost to flash the FRDM-MCXN947 development board. Using the bin file works successfully. However, I receive a kStatus_FlashAlignmentError error when using the hex file. I have tried the two blhost methods below: $ blhost -u 0x1Fc9,0x014F -j -- flash-erase-all { "command" : "flash-erase-all", "response" : [], "status" : { "description" : "0 (0x0) Success.", "value" : 0 } } $ blhost -u 0x1Fc9,0x014F flash-image ./DevBoard.hex erase Inject command 'flash-image' Response status = 101 (0x65) kStatus_FlashAlignmentError $ blhost -u 0x1Fc9,0x014F -j -- flash-erase-all { "command" : "flash-erase-all", "response" : [], "status" : { "description" : "0 (0x0) Success.", "value" : 0 } } $ blhost -u 0x1Fc9,0x014F -j -- write-memory 0x0 ./DevBoard.hex { "command" : "write-memory", "response" : [], "status" : { "description" : "10004 (0x2714) No response packet from target device.", "value" : 10004 } } Is there a different method I should be using in the Post-build step or in the blhost command to get the hex file to work successfully? Boot ROM|Booting | Flash Development Board Re: Binary Utilities -> Create hex in MCUXpresso results in kStatus_FlashAlignmentError Thanks for sharing your memory configuration and confirm that you are able to debug with the axf file.
Your memory configuration is the default, so this is not the problem.
Could you please try to flash with blhost using a .bin file of your project?
You could generate just as you generate the hex file but selecting the bin option.
I want to review if the issue is at the translation of the .axf to .hex Re: Binary Utilities -> Create hex in MCUXpresso results in kStatus_FlashAlignmentError I have not intentionally changed the memory configuration. I've included a screen snap of my settings. Is this enough to tell if anything has changed? I am able to use the debugger when connected to the FRDM-MCXN947 running my firmware. Re: Binary Utilities -> Create hex in MCUXpresso results in kStatus_FlashAlignmentError Hi @Don_Adams_HPE
Thanks for sharing your findings.
Could you please review if your memory configuration is the default or do you modify it?
From the gpio_led_output_cm33_core0 this is the memory configuration:
You could see it Right Click on the project go to Properties -> C/C++ Build -> MCU settings
The issue seems more like a configuration issue with the memory alignment.
Could you confirm if you are able to debug your code with linkserver in the FRDM-MCXN947?
BR Re: Binary Utilities -> Create hex in MCUXpresso results in kStatus_FlashAlignmentError Thank you for the response. I did not try using UART. However, I did try the same SDK example you used over USB. I tried these two SDK example projects: frdmmcxn947_gpio_led_output_cm33_core0.hex frdmmcxn947_dev_phdc_weighscale_freertos_cm33_core0.hex I created these files using the Binary Utilities -> Create hex method in MCUXpresso. As is shown in the output below, both of these files worked using USB. I then did the same method with my code to create the DevBoard.hex file and it fails with the kStatus_FlashAlignmentError. My code started with the weighscale SDK example code, but has been heavily modified since then. I do not know how to troubleshoot and fix this problem. A hex file flashed using USB is one of our project requirements. Sample Output: $ blhost -u 0x1Fc9,0x014F -j -- flash-erase-all { "command" : "flash-erase-all", "response" : [], "status" : { "description" : "0 (0x0) Success.", "value" : 0 } } $ blhost -u 0x1Fc9,0x014F -j -- flash-image ./frdmmcxn947_gpio_led_output_cm33_core0.hex erase { "command" : "flash-image", "response" : [], "status" : { "description" : "0 (0x0) Success.", "value" : 0 } } $ blhost -u 0x1Fc9,0x014F -j -- reset { "command" : "reset", "response" : [], "status" : { "description" : "0 (0x0) Success.", "value" : 0 } } $ blhost -u 0x1Fc9,0x014F -j -- flash-erase-all { "command" : "flash-erase-all", "response" : [], "status" : { "description" : "0 (0x0) Success.", "value" : 0 } } $ blhost -u 0x1Fc9,0x014F -j -- flash-image ./frdmmcxn947_dev_phdc_weighscale_freertos_cm33_core0.hex erase { "command" : "flash-image", "response" : [], "status" : { "description" : "0 (0x0) Success.", "value" : 0 } } $ blhost -u 0x1Fc9,0x014F -j -- reset { "command" : "reset", "response" : [], "status" : { "description" : "0 (0x0) Success.", "value" : 0 } } $ blhost -u 0x1Fc9,0x014F -j -- flash-erase-all { "command" : "flash-erase-all", "response" : [], "status" : { "description" : "0 (0x0) Success.", "value" : 0 } } $ blhost -u 0x1Fc9,0x014F -j -- flash-image ./DevBoard.hex erase { "command" : "flash-image", "response" : [], "status" : { "description" : "101 (0x65) kStatus_FlashAlignmentError", "value" : 101 } } Re: Binary Utilities -> Create hex in MCUXpresso results in kStatus_FlashAlignmentError Hi @Don_Adams_HPE
Thank you for your post!
I couldn't replicate your issue at my end. I use one of the examples of the SDK to generate the .hex file, the difference I noticed is that I do it with UART setting the board in ISP and you do it with USB. Could you please try do it over UART? Also are you able to debug the .axf you have?
Let me know your results
BR Re: Binary Utilities -> Create hex in MCUXpresso results in kStatus_FlashAlignmentError We have discovered a fix to the problem. Removing the 'erase' at the end of the command works successfully: $ blhost -u 0x1Fc9,0x014F -j -- flash-erase-all { "command" : "flash-erase-all", "response" : [], "status" : { "description" : "0 (0x0) Success.", "value" : 0 } } $ blhost -u 0x1Fc9,0x014F -j -- flash-image DevBoard.hex { "command" : "flash-image", "response" : [], "status" : { "description" : "0 (0x0) Success.", "value" : 0 } } $ blhost -u 0x1Fc9,0x014F -j -- reset { "command" : "reset", "response" : [], "status" : { "description" : "0 (0x0) Success.", "value" : 0 } } This does not work: $ blhost -u 0x1Fc9,0x014F -j -- flash-image DevBoard.hex erase { "command" : "flash-image", "response" : [], "status" : { "description" : "101 (0x65) kStatus_FlashAlignmentError", "value" : 101 } } Re: Binary Utilities -> Create hex in MCUXpresso results in kStatus_FlashAlignmentError Yes, the bin file works, the hex file does not. $ blhost -u 0x1Fc9,0x014F -j -- flash-erase-all { "command" : "flash-erase-all", "response" : [], "status" : { "description" : "0 (0x0) Success.", "value" : 0 } } $ blhost -u 0x1Fc9,0x014F -j -- write-memory 0x0 ./DevBoard.bin { "command" : "write-memory", "response" : [], "status" : { "description" : "0 (0x0) Success.", "value" : 0 } } $ blhost -u 0x1Fc9,0x014F -j -- reset { "command" : "reset", "response" : [], "status" : { "description" : "0 (0x0) Success.", "value" : 0 } }
查看全文