Hi @adriantudor @paulvlase
actually I posted it 3 hours ago. But somehow now I can not see it in the forum. I post it again...
I keep trying hard to make the demo "PMSM_ClosedLoop" run, but until now without success...
Step 1:
From the original demo model, I comment out both the blocks "FOC" and "PosObserver". It builds successfully, without any errors.

Step 2:
Activate only "PosObserver" ("FOC" commented out). Replace with blocks from lib: "AMCLIB_BemfObsrvDQ_F16" and "AMCLIB_TrackObsrv_F16" and changes names to shorter names "BemfObsrvDQ" and "TrackObsrv":

Build warnings/errors:
=== Build (Elapsed: 45 sec) ===
### Starting build procedure for: PMSM_Sensorless
### Generating code and artifacts to 'Model specific' folder structure
### Generating code into build folder: D:\MATLAB\AddOns\Toolboxes\NXP_MBDToolbox_S12ZVMx\S12ZVM_Examples\s12zvm\mc\PMSM_Demo\PMSM_ClosedLoop\PMSM_Sensorless_mbd_rtw
Warning:The input bus to block 'PMSM_Sensorless/FastLoopAlgorithm/PosObserver/BemfObsrvDQ/pIAB' does not match the bus specified by the bus object 'SWLIBS_2Syst_F16' on the block dialog : Signal 'signal1' does not match the name 'SWLIBS_2Syst_F16.f16Arg1' of the corresponding bus element in the bus object. To disable this diagnostic, set the Configuration Parameters > Diagnostics > Connectivity > 'Element name mismatch' option to 'None'.
Warning:The input bus to block 'PMSM_Sensorless/FastLoopAlgorithm/PosObserver/BemfObsrvDQ/pIAB' does not match the bus specified by the bus object 'SWLIBS_2Syst_F16' on the block dialog : Signal 'signal2' does not match the name 'SWLIBS_2Syst_F16.f16Arg2' of the corresponding bus element in the bus object. To disable this diagnostic, set the Configuration Parameters > Diagnostics > Connectivity > 'Element name mismatch' option to 'None'.
Warning:The input bus to block 'PMSM_Sensorless/FastLoopAlgorithm/PosObserver/BemfObsrvDQ/pUAB' does not match the bus specified by the bus object 'SWLIBS_2Syst_F16' on the block dialog : Signal 'signal1' does not match the name 'SWLIBS_2Syst_F16.f16Arg1' of the corresponding bus element in the bus object. To disable this diagnostic, set the Configuration Parameters > Diagnostics > Connectivity > 'Element name mismatch' option to 'None'.
Warning:The input bus to block 'PMSM_Sensorless/FastLoopAlgorithm/PosObserver/BemfObsrvDQ/pUAB' does not match the bus specified by the bus object 'SWLIBS_2Syst_F16' on the block dialog : Signal 'signal2' does not match the name 'SWLIBS_2Syst_F16.f16Arg2' of the corresponding bus element in the bus object. To disable this diagnostic, set the Configuration Parameters > Diagnostics > Connectivity > 'Element name mismatch' option to 'None'.
Warning:The input bus to block 'PMSM_Sensorless/FastLoopAlgorithm/PosObserver/BemfObsrvDQ/AMCLIB_BemfObsrvDQ_SF' does not match the bus specified by the bus object 'SWLIBS_2Syst_F16' on the block dialog : Signal 'signal1' does not match the name 'SWLIBS_2Syst_F16.f16Arg1' of the corresponding bus element in the bus object. To disable this diagnostic, set the Configuration Parameters > Diagnostics > Connectivity > 'Element name mismatch' option to 'None'.
Warning:The input bus to block 'PMSM_Sensorless/FastLoopAlgorithm/PosObserver/BemfObsrvDQ/AMCLIB_BemfObsrvDQ_SF' does not match the bus specified by the bus object 'SWLIBS_2Syst_F16' on the block dialog : Signal 'signal2' does not match the name 'SWLIBS_2Syst_F16.f16Arg2' of the corresponding bus element in the bus object. To disable this diagnostic, set the Configuration Parameters > Diagnostics > Connectivity > 'Element name mismatch' option to 'None'.
Warning:The input bus to block 'PMSM_Sensorless/FastLoopAlgorithm/PosObserver/BemfObsrvDQ/AMCLIB_BemfObsrvDQ_SF' does not match the bus specified by the bus object 'SWLIBS_2Syst_F16' on the block dialog : Signal 'signal1' does not match the name 'SWLIBS_2Syst_F16.f16Arg1' of the corresponding bus element in the bus object. To disable this diagnostic, set the Configuration Parameters > Diagnostics > Connectivity > 'Element name mismatch' option to 'None'.
Warning:The input bus to block 'PMSM_Sensorless/FastLoopAlgorithm/PosObserver/BemfObsrvDQ/AMCLIB_BemfObsrvDQ_SF' does not match the bus specified by the bus object 'SWLIBS_2Syst_F16' on the block dialog : Signal 'signal2' does not match the name 'SWLIBS_2Syst_F16.f16Arg2' of the corresponding bus element in the bus object. To disable this diagnostic, set the Configuration Parameters > Diagnostics > Connectivity > 'Element name mismatch' option to 'None'.
Warning:Warning: File 'codedescriptor.dmr' not found.
Warning:Warning: File 'codedescriptor.dmr' not found.
Warning:Warning: File 'codedescriptor.dmr' not found.
Warning:Warning: File 'codedescriptor.dmr' not found.
### Invoking Target Language Compiler on PMSM_Sensorless.rtw
### Using System Target File: D:\MATLAB\AddOns\Toolboxes\NXP_MBDToolbox_S12ZVMx\mctbx_s12zvm\mctbx_s12zvm\mcd_s12zvm.tlc
### Loading TLC function libraries
### Generating TLC interface API for custom data
### Initial pass through model to cache user defined code
### Caching model source code
...............................................................................
...............................................................................
.................................................
### Writing header file PMSM_Sensorless_types.h
### Writing source file PMSM_Sensorless.c
### Writing header file PMSM_Sensorless_private.h
### Writing header file PMSM_Sensorless.h
.
### Writing source file profile_buffer.c
### Writing header file profile_buffer.h
### Writing header file rtwtypes.h
### Writing header file zero_crossing_types.h
### Writing source file PMSM_Sensorless_FastLoopOutput.c
.
### Writing source file PosObserver.c
### Writing source file FastLoopAlgorithm.c
### Writing source file FastLoopInput.c
### Writing source file PositionMode.c
### Writing source file SlowLoopAlgorithm.c
### Writing header file PMSM_Sensorless_FastLoopOutput.h
.
### Writing header file PosObserver.h
### Writing header file FastLoopAlgorithm.h
### Writing header file FastLoopInput.h
### Writing header file PositionMode.h
### Writing header file SlowLoopAlgorithm.h
.
### Writing source file PMSM_Sensorless_data.c
### Writing header file mc9s12zvm.h
### Writing header file tim_param.h
### Writing header file fm_data_rec.h
### Writing source file mcd_main.c
.
### Writing header file clk_init.h
### Writing header file vector.h
### Writing header file isr_lvl.h
### Writing source file isr_lvl.c
### TLC code generation complete.
.### Evaluating PostCodeGenCommand specified in the model
.
### Processing Template Makefile: D:\MATLAB\AddOns\Toolboxes\NXP_MBDToolbox_S12ZVMx\mctbx_s12zvm\mctbx_s12zvm\mcd_s12zvm.tmf
Warning:Found legacy make variables |>START_MDLREFINC_EXPAND_INCLUDES<|, |>END_MDLREFINC_EXPAND_INCLUDES<|, |>MODELREF_INC_PATH<| in the template makefile D:\MATLAB\AddOns\Toolboxes\NXP_MBDToolbox_S12ZVMx\mctbx_s12zvm\mctbx_s12zvm\mcd_s12zvm.tmf. The variables are no longer required. You can remove the variables.
### Creating D:\MATLAB\AddOns\Toolboxes\NXP_MBDToolbox_S12ZVMx\S12ZVM_Examples\s12zvm\mc\PMSM_Demo\PMSM_ClosedLoop\PMSM_Sensorless_mbd_rtw\PMSM_Sensorless.mk from D:\MATLAB\AddOns\Toolboxes\NXP_MBDToolbox_S12ZVMx\mctbx_s12zvm\mctbx_s12zvm\mcd_s12zvm.tmf
### Building PMSM_Sensorless: .\PMSM_Sensorless.bat
### Build procedure for PMSM_Sensorless aborted due to an error.
Warning:Found legacy make variables |>S_FUNCTIONS<|, |>S_FUNCTIONS_OBJ<| in the template makefile D:\MATLAB\AddOns\Toolboxes\NXP_MBDToolbox_S12ZVMx\mctbx_s12zvm\mctbx_s12zvm\mcd_s12zvm.tmf. The variables are no longer required. You can remove the variables.
Warning:Found legacy make variables |>SHARED_BIN_DIR<|, |>SHARED_LIB<|, |>SHARED_SRC<|, |>SHARED_SRC_DIR<| in the template makefile D:\MATLAB\AddOns\Toolboxes\NXP_MBDToolbox_S12ZVMx\mctbx_s12zvm\mctbx_s12zvm\mcd_s12zvm.tmf. The variables are no longer required. You can remove the variables.
Error:
D:\MATLAB\AddOns\Toolboxes\NXP_MBDToolbox_S12ZVMx\S12ZVM_Examples\s12zvm\mc\PMSM_Demo\PMSM_ClosedLoop\PMSM_Sensorless_mbd_rtw>set MATLAB=D:\matlab2020a
D:\MATLAB\AddOns\Toolboxes\NXP_MBDToolbox_S12ZVMx\S12ZVM_Examples\s12zvm\mc\PMSM_Demo\PMSM_ClosedLoop\PMSM_Sensorless_mbd_rtw>"D:\matlab2020a\bin\win64\gmake" -f PMSM_Sensorless.mk COPY_MDLREF_INCLUDES=0 GENERATE_ERT_S_FUNCTION=0 INCLUDE_MDL_TERMINATE_FCN=1 COMBINE_OUTPUT_UPDATE_FCNS=1 MULTI_INSTANCE_CODE=0 INTEGER_CODE=0 CW_TARGET_DEFAULT_LCF=1 CW_TARGET_USER_LCF="mc9s12zvml128_FLASH.prm" CS_TARGET_DEFAULT_LCF=1 CS_TARGET_USER_LCF="mc9s12zvm32_FLASH.lkf" PIL_DOWNLOAD=0 RBL_DOWNLOAD=1 ISPROTECTINGMODEL=NOTPROTECTING OPTS="-DTID01EQ=0"
Cleaning...
RELATIVE_PATH_TO_ANCHOR is ..
==== Removing object files from build directory ====
Compiler details : "C:/Freescale/Codewarrior_11/MCU/S12lisa_Tools/Build_Tools/mwccs12lisa" -c -model small -bfield_lsbit_first -bfield_reduce_type -opt level=2 -opt speed -inline auto -requireprotos -Cpp_Exceptions off -char unsigned -msgstyle parseable -sym full -nostdinc -nosyspath -w possible -w extended -w extracomma -w emptydecl -w structclass -ansi off -ipa function -inline smart,auto,bottomup -bool off -wchar_t off -RTTI off -llong_size=8 -double_size 8 -lang c99 -gccext on -o SetupFiles -I. -I.. -I../instrumented -I.. -I"D:\matlab2020a\simulink\include" -I"D:\matlab2020a\extern\include" -I"D:\matlab2020a\rtw\c\src" -I"D:\matlab2020a\rtw\c\libsrc" -I"D:\matlab2020a\rtw\c\src\ext_mode\common" -I"D:\matlab2020a\rtw\c\src\ext_mode\tcpip" -I"D:\matlab2020a\rtw\c\src\ext_mode\serial" -I"D:\matlab2020a\rtw\c\src\ext_mode\custom" -ID:\MATLAB\AddOns\Toolboxes\NXP_MBDToolbox_S12ZVMx\S12ZVM_Examples\s12zvm\mc\PMSM_Demo\PMSM_ClosedLoop -ID:\MATLAB\AddOns\Toolboxes\NXP_MBDToolbox_S12ZVMx\S12ZVM_Examples\s12zvm\mc\PMSM_Demo\PMSM_ClosedLoop\PMSM_Sensorless_mbd_rtw -ID:\matlab2020a\extern\include -ID:\matlab2020a\simulink\include -ID:\matlab2020a\rtw\c\src -ID:\matlab2020a\rtw\c\src\ext_mode\common -ID:\matlab2020a\rtw\c\ert -I"C:/Freescale/Codewarrior_11\MCU\S12lisa_Support\s12lisac\include" -DTID01EQ=0
Assembler details : "C:/Freescale/Codewarrior_11/MCU/S12lisa_Tools/Build_Tools/mwccs12lisa" -CMacAngBrackOn -ViewHidden
Product: PMSM_Sensorless.elf
Build product type: executable
Building file FastLoopAlgorithm.o...
"C:/Freescale/Codewarrior_11/MCU/S12lisa_Tools/Build_Tools/mwccs12lisa" -c -model small -bfield_lsbit_first -bfield_reduce_type -opt level=2 -opt speed -inline auto -requireprotos -Cpp_Exceptions off -char unsigned -msgstyle parseable -sym full -nostdinc -nosyspath -w possible -w extended -w extracomma -w emptydecl -w structclass -ansi off -ipa function -inline smart,auto,bottomup -bool off -wchar_t off -RTTI off -llong_size=8 -double_size 8 -lang c99 -gccext on -o FastLoopAlgorithm.o -I. -I.. -I../instrumented -I.. -I"D:\matlab2020a\simulink\include" -I"D:\matlab2020a\extern\include" -I"D:\matlab2020a\rtw\c\src" -I"D:\matlab2020a\rtw\c\libsrc" -I"D:\matlab2020a\rtw\c\src\ext_mode\common" -I"D:\matlab2020a\rtw\c\src\ext_mode\tcpip" -I"D:\matlab2020a\rtw\c\src\ext_mode\serial" -I"D:\matlab2020a\rtw\c\src\ext_mode\custom" -ID:\MATLAB\AddOns\Toolboxes\NXP_MBDToolbox_S12ZVMx\S12ZVM_Examples\s12zvm\mc\PMSM_Demo\PMSM_ClosedLoop -ID:\MATLAB\AddOns\Toolboxes\NXP_MBDToolbox_S12ZVMx\S12ZVM_Examples\s12zvm\mc\PMSM_Demo\PMSM_ClosedLoop\PMSM_Sensorless_mbd_rtw -ID:\matlab2020a\extern\include -ID:\matlab2020a\simulink\include -ID:\matlab2020a\rtw\c\src -ID:\matlab2020a\rtw\c\src\ext_mode\common -ID:\matlab2020a\rtw\c\ert -I"C:/Freescale/Codewarrior_11\MCU\S12lisa_Support\s12lisac\include" -DTID01EQ=0 FastLoopAlgorithm.c
C:/Freescale/Codewarrior_11/MCU/S12lisa_Tools/Build_Tools/mwccs12lisa|Compiler|Error
(D:\MATLAB\AddOns\Toolboxes\NXP_MBDToolbox_S12ZVMx\S12ZVM_Examples\s12zvm\mc\PMSM_Demo\PMSM_ClosedLoop\PMSM_Sensorless_mbd_rtw\FastLoopAlgorithm.h|26|9|10|811|10)
=#include "gmclib.h"
>the file 'gmclib.h' cannot be opened
Errors caused tool to abort.
gmake: *** [FastLoopAlgorithm.o] Error 1
Error(s) encountered while building "PMSM_Sensorless"
Step 3:
Comment out "AMCLIB_BemfObsrvDQ_F16"

Build successfully, no errors.
Do you have any ideas, what I could do?
Many thanks in advance!