problem of custom target of board stm32f429

12 vues (au cours des 30 derniers jours)
ramzi ben messaoud
ramzi ben messaoud le 11 Mai 2020
Dear friend
I am developing a target specific to the stm32f429disc1 card, I am following the steps described in the pages "Implement a Target for arm cortex M of the help mathworks page". I'm stuck in step 5 "Activate the Application Deployment Feature"
I wrote the following code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% close all
% clear all
%deleteTarget(tgt);
%% create target
tgt = createTarget('My ARM','ARM Cortex-M','c:/myhardcard')
% saveTarget(tgt);
% testTarget(tgt,'framework');
%% create hardware STM32F429-Dicovery
hw = createHardware ( 'STM32F429-Dicovery' );
hw.DeviceID = 'ARM Cortex-M4F' ;
map(tgt,hw,'STM32F429-Dicovery');
show(tgt);
io = addNewSerialInterface(hw,'My interface')
%saveTarget(tgt);
% testTarget(tgt,'hardware');
%%
dep = addNewDeployer(tgt,'My New Deployer');
show(tgt);
map(tgt,hw,dep);
show(tgt);
toolchain = dep.addNewToolchain('GNU Tools for ARM Embedded Processors');
buildConfiguration = toolchain.addNewBuildConfiguration('My Build Configuration');
buildConfiguration.IncludePaths ='$(ARM_CORTEX_M_ROOT_DIR)/include';
% $**
buildConfiguration.CompilerFlags = '-mcpu=cortex-m4 -mthumb -mlittle-endian -mthumb-interwork ';
buildConfiguration.LinkerFlags = '-mcpu=cortex-m4 -mthumb -mlittle-endian -mthumb-interwork -T STM32F429xI.ld'
buildConfiguration.AssemblerFlags = '-mcpu=cortex-m4 -mthumb -mlittle-endian -mthumb-interwork '
buildConfiguration.Defines = {'ARM_MATH_CM4=1', 'NULL=0', 'EXIT_FAILURE=1'}
dep.Tokens{1} = struct('Name', 'ARM_CORTEX_M_ROOT_DIR', 'Value', 'codertarget.arm_cortex_m.internal.getSpPkgRootDir');
loader = dep.addNewLoader('My Loader');
loader.LoadCommand = 'matlab:codertarget.arm_cortex_m.internal.loadAndRun';
loader.LoadCommandArguments ='-f board/stm32f429disc1.cfg';
saveTarget(tgt);
testTarget(tgt,'deployer');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
and the error message is as follows
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
val =
'Running matlabshared.targetsdk.verify.Deployer
### Starting build procedure for model: modelBasicBuild
### Generating code and artifacts to 'Model specific' folder structure
### Generating code into build folder: C:\Users\ramzi\AppData\Local\Temp\tp99fb16ab_b020_4469_99d7_51462ecc07b1\modelBasicBuild_ert_rtw
### Invoking Target Language Compiler on modelBasicBuild.rtw
### Using System Target File: C:\Program Files\MATLAB\R2018b\rtw\c\ert\ert.tlc
### Loading TLC function libraries
......
### Initial pass through model to cache user defined code
### Caching model source code
.........................
### Writing header file modelBasicBuild_types.h
### Writing header file modelBasicBuild.h
.
### Writing header file rtwtypes.h
### Writing source file modelBasicBuild.c
### Writing header file modelBasicBuild_private.h
### Writing source file modelBasicBuild_data.c
### Writing header file rtmodel.h
.
### Writing source file ert_main.c
### TLC code generation complete.
### Evaluating PostCodeGenCommand specified in the model
### Using toolchain: GNU Tools for ARM Embedded Processors v7.2.1 | gmake (64-bit Windows)
### Creating 'C:\Users\ramzi\AppData\Local\Temp\tp99fb16ab_b020_4469_99d7_51462ecc07b1\modelBasicBuild_ert_rtw\modelBasicBuild.mk' ...
### Building 'modelBasicBuild': "C:\PROGRA~1\MATLAB\R2018b\bin\win64\gmake" -f modelBasicBuild.mk all
MW_GNU_ARM_TOOLS_PATH = C:/PROGRA~3/MATLAB/SUPPOR~1/R2018b/3P778C~1.INS/GNUARM~1.INS/win/bin
C:\Users\ramzi\AppData\Local\Temp\tp99fb16ab_b020_4469_99d7_51462ecc07b1\modelBasicBuild_ert_rtw>cd .
C:\Users\ramzi\AppData\Local\Temp\tp99fb16ab_b020_4469_99d7_51462ecc07b1\modelBasicBuild_ert_rtw>if "" == "" ("C:\PROGRA~1\MATLAB\R2018b\bin\win64\gmake" -f modelBasicBuild.mk all ) else ("C:\PROGRA~1\MATLAB\R2018b\bin\win64\gmake" -f modelBasicBuild.mk )
C:/PROGRA~3/MATLAB/SUPPOR~1/R2018b/3P778C~1.INS/GNUARM~1.INS/win/bin/arm-none-eabi-gcc -ffunction-sections -fdata-sections -Wall -MMD -MP -MF"modelBasicBuild.dep" -MT"modelBasicBuild.o" -c -O0 -mcpu=cortex-m4 -mthumb -mlittle-endian -mthumb-interwork -DMODEL=modelBasicBuild -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DARM_MATH_CM4=1 -DNULL=0 -DEXIT_FAILURE=1 -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DTID01EQ=0 -DARM_MATH_CM4=1 -DNULL=0 -DEXIT_FAILURE=1 -DSTACK_SIZE=64 -DRT -DMODEL=modelBasicBuild -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IC:/Users/ramzi/AppData/Local/Temp/tp99fb16ab_b020_4469_99d7_51462ecc07b1 -IC:/Users/ramzi/AppData/Local/Temp/tp99fb16ab_b020_4469_99d7_51462ecc07b1/modelBasicBuild_ert_rtw -IC:/PROGRA~1/MATLAB/R2018b/extern/include -IC:/PROGRA~1/MATLAB/R2018b/simulink/include -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/ert -IC:/Users/ramzi/AppData/Local/Temp/tp99fb16ab_b020_4469_99d7_51462ecc07b1/slprj/ert/_sharedutils -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2018b/toolbox/target/SUPPOR~1/ARM_CO~1/include @modelBasicBuild_comp.rsp -o modelBasicBuild.o modelBasicBuild.c
C:/PROGRA~3/MATLAB/SUPPOR~1/R2018b/3P778C~1.INS/GNUARM~1.INS/win/bin/arm-none-eabi-gcc -ffunction-sections -fdata-sections -Wall -MMD -MP -MF"modelBasicBuild_data.dep" -MT"modelBasicBuild_data.o" -c -O0 -mcpu=cortex-m4 -mthumb -mlittle-endian -mthumb-interwork -DMODEL=modelBasicBuild -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DARM_MATH_CM4=1 -DNULL=0 -DEXIT_FAILURE=1 -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DTID01EQ=0 -DARM_MATH_CM4=1 -DNULL=0 -DEXIT_FAILURE=1 -DSTACK_SIZE=64 -DRT -DMODEL=modelBasicBuild -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IC:/Users/ramzi/AppData/Local/Temp/tp99fb16ab_b020_4469_99d7_51462ecc07b1 -IC:/Users/ramzi/AppData/Local/Temp/tp99fb16ab_b020_4469_99d7_51462ecc07b1/modelBasicBuild_ert_rtw -IC:/PROGRA~1/MATLAB/R2018b/extern/include -IC:/PROGRA~1/MATLAB/R2018b/simulink/include -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/ert -IC:/Users/ramzi/AppData/Local/Temp/tp99fb16ab_b020_4469_99d7_51462ecc07b1/slprj/ert/_sharedutils -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2018b/toolbox/target/SUPPOR~1/ARM_CO~1/include @modelBasicBuild_comp.rsp -o modelBasicBuild_data.o modelBasicBuild_data.c
C:/PROGRA~3/MATLAB/SUPPOR~1/R2018b/3P778C~1.INS/GNUARM~1.INS/win/bin/arm-none-eabi-gcc -ffunction-sections -fdata-sections -Wall -MMD -MP -MF"ert_main.dep" -MT"ert_main.o" -c -O0 -mcpu=cortex-m4 -mthumb -mlittle-endian -mthumb-interwork -DMODEL=modelBasicBuild -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DARM_MATH_CM4=1 -DNULL=0 -DEXIT_FAILURE=1 -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DTID01EQ=0 -DARM_MATH_CM4=1 -DNULL=0 -DEXIT_FAILURE=1 -DSTACK_SIZE=64 -DRT -DMODEL=modelBasicBuild -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IC:/Users/ramzi/AppData/Local/Temp/tp99fb16ab_b020_4469_99d7_51462ecc07b1 -IC:/Users/ramzi/AppData/Local/Temp/tp99fb16ab_b020_4469_99d7_51462ecc07b1/modelBasicBuild_ert_rtw -IC:/PROGRA~1/MATLAB/R2018b/extern/include -IC:/PROGRA~1/MATLAB/R2018b/simulink/include -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/ert -IC:/Users/ramzi/AppData/Local/Temp/tp99fb16ab_b020_4469_99d7_51462ecc07b1/slprj/ert/_sharedutils -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2018b/toolbox/target/SUPPOR~1/ARM_CO~1/include @modelBasicBuild_comp.rsp -o ert_main.o ert_main.c
"### Creating standalone executable "../modelBasicBuild.elf" ..."
C:/PROGRA~3/MATLAB/SUPPOR~1/R2018b/3P778C~1.INS/GNUARM~1.INS/win/bin/arm-none-eabi-g++ -Wl,--gc-sections -Wl,-Map="modelBasicBuild.map" -mcpu=cortex-m4 -mthumb -mlittle-endian -mthumb-interwork -T STM32F429xI.ld -o ../modelBasicBuild.elf @modelBasicBuild.rsp -lm
c:/progra~3/matlab/suppor~1/r2018b/3p778c~1.ins/gnuarm~1.ins/win/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: cannot open linker script file STM32F429xI.ld: No such file or directory
collect2.exe: error: ld returned 1 exit status
gmake: *** [../modelBasicBuild.elf] Error 1
C:\Users\ramzi\AppData\Local\Temp\tp99fb16ab_b020_4469_99d7_51462ecc07b1\modelBasicBuild_ert_rtw>echo The make command returned an error of 2
The make command returned an error of 2
C:\Users\ramzi\AppData\Local\Temp\tp99fb16ab_b020_4469_99d7_51462ecc07b1\modelBasicBuild_ert_rtw>An_error_occurred_during_the_call_to_make
'An_error_occurred_during_the_call_to_make' n'est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.
### Build procedure for model: 'modelBasicBuild' aborted due to an error.
================================================================================
Error occurred in matlabshared.targetsdk.verify.Deployer/checkBuildDownload and it did not run to completion.
---------
Error ID:
---------
'RTW:buildProcess:fatalBuildError'
--------------
Error Details:
--------------
Error using coder.make.Builder/coder_diagnose
Error(s) encountered while building "modelBasicBuild":
### Failed to generate all binary outputs.
Error in coder.make.Builder/coder_build
Error in coder.make.Builder/run
Error in coder.make.invokeBuilder
Error in RTW/genMakefileAndBuild
Error in RTW/genMakefileAndBuildWrapper
Error in coder.internal.compileStage
compileResult = coder.internal.compileStage...
buildResult = buildProcedure...
buildResult = obj.make_rtw(varargin);
buildResult = h.make_rtw(buildArgs, varargin{:});
Error in build_target
Error in build_target
Error in build_standalone_rtw_target
Error in slbuild_private
Error in slbuild_private
[varargout{1:nargout}]=feval(varargin{:});
sl('slbuild_private', mdl, target, varargin{2:end});
slbuild(sys, 'StandaloneRTWTarget', ...
Error in matlabshared.targetsdk.verify.Deployer/checkBuildDownload
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
please can you help me and thank you.
Best regards

Réponse acceptée

ramzi ben messaoud
ramzi ben messaoud le 24 Mai 2020
thanks to the help of Mr. Vito Antonio Nardi (in the web site https://www.researchgate.net/) the deployment problem is solved. the solution proposed by Mr. Vito Antonio Nardi is to make changes to the stm32f429.ld file in parenthesis is Mr. Vito's proposal:
(I found a workaround for your issue:
* install Embedded Coder Interface to QEMU Emulator (it will be needed for the tests)
* use the .ld file attached, you can put it in some arbitrary folder
* add the full path to .ld file in your script, for example:
buildConfiguration.LinkerFlags = '-mcpu = cortex-m4 -mthumb -mlittle endian -mthumb-interwork -TC: \ ProgramData \ MATLAB \ SupportPackages \ R2018b \ 3P.instrset \ mbedlibrary-stm.instrset \ 0f02307a0877 \ TARGET_DISCO_F429ZI \ TOOLCHAIN_GCC_ARM \ STM32F429xI .ld '
for me (see also attached file)
as you can see from the .mat report, it works.
In fixing the .ld file I made some assumption about Discovery memory mapping which should be correct. Anyway before going further in your projects please make some preliminary (and simple) tests to see wheter it works as expected. )

Plus de réponses (1)

David Fink
David Fink le 11 Mai 2020
It looks like there are a few problems with the Makefile:
  1. "codertarget.arm_cortex_a.internal.getSpPkgRootDir" should have been evaluated before being put in the makefile
  2. The rule to build the executable seems to be missing the object files
Please contact MathWorks Technical Support to investigate this issue further.
  6 commentaires
ramzi ben messaoud
ramzi ben messaoud le 11 Mai 2020
thanks for the answer i removed the quotes but the proléme remains the same
ramzi ben messaoud
ramzi ben messaoud le 24 Mai 2020
thanks to the help of Mr. Vito Antonio Nardi (in the web site https://www.researchgate.net/) the deployment problem is solved. the solution proposed by Mr. Vito Antonio Nardi is to make changes to the stm32f429.ld file in parenthesis is Mr. Vito's proposal:
(I found a workaround for your issue:
* install Embedded Coder Interface to QEMU Emulator (it will be needed for the tests)
* use the .ld file attached, you can put it in some arbitrary folder
* add the full path to .ld file in your script, for example:
buildConfiguration.LinkerFlags = '-mcpu = cortex-m4 -mthumb -mlittle endian -mthumb-interwork -TC: \ ProgramData \ MATLAB \ SupportPackages \ R2018b \ 3P.instrset \ mbedlibrary-stm.instrset \ 0f02307a0877 \ TARGET_DISCO_F429ZI \ TOOLCHAIN_GCC_ARM \ STM32F429xI .ld '
for me (see also attached file)
as you can see from the .mat report, it works.
In fixing the .ld file I made some assumption about Discovery memory mapping which should be correct. Anyway before going further in your projects please make some preliminary (and simple) tests to see wheter it works as expected. )

Connectez-vous pour commenter.

Produits


Version

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by