Greetings Experts
I am trying to compile the TEE sample with DS-5. I downloaded the latest version of DS-5, and created a C project. I was able to put in the main_secure.c file and build ok. I then tried to add monitor.s file to the project by adding another source file. I get the following errors:
Would someone please compile the project, and advise in high level what sort of project I need to create and how to import the source files into my project please?
Sean
This assembly file is "ARM style" not "GCC style".
Are you sure you're using ARM compiler not GCC?
Hi David
Yes. I downloaded DS-5, which is arm's IDE; the README document which comes with the software specifically stated armasm. I also have a stronger proof of it running arm syntax; the C file goes in fine. One of the C source files in the project goes in the IDE without generating any errors; in that file there are assembly calls which are written in arm syntax.
My goal is to get the executable one way other the other. So, if there is a compiler you would recommend, I can download it and use it.
Given DS-5 is an arm associated product, would you be able to download it, and compile the project?
Looking at the README file that comes with the project, seems there are two different executable files which need to be created? Is that right? I need the high level steps of which files to compile together and how to link them to get the final executable that I need. i.e. *if* the steps are different for whichever compiler you may recommend.
What I am trying to say is I am open to any compiler as long as I get some instructions as to how to go about compiling it.
I really appreciate your expert help.
Hi Seanans,
Just to confirm, you're using sample code "EB_TrustZone_Example.zip", right?
Let's assume you're using it.
I had downloaded it and found the same content in "monitor.S" with the picture you showed.
I passed compiling stage of all soure files (including monitor.S).
You mentioned that:
One of the C source files in the project goes in the IDE without generating any errors; in that file there are assembly calls which are written in arm syntax.
For the "assembly calls":
Did you mean your C code called a function which is implemented in assembly file? Or an inline assembly code in C function?
BTW, can you attach your compiler setting?
You can find it by "right click your project" -> Properties ->C/C++ Build->Settings->Tool Settings
Thank you for the message. I believe the assembly call I was referring to was an inline assembly code in C function. Enclosed, please find updated pics of my project. It has a capture of the settings as well as the error I see at this point:
At this point, I have added all the files in the source directory of EB_TrustZone_Example.zip file. I am not sure what the files call scatter_normal.txt and scatter_secure.txt do. I have not added them to my project yet. I created this project by first following the Hello World tutorial of DS_5 for creating a project; instead of adding the hello world code I added the first C file. I then added the rest by adding source files to the project. If there is a more effective way of creating this project such as importing a zip file, please do let me know.
btw, my original error was resolved by restarting eclipse; I am sure you noticed that.
Regards-
Hi Sean,
It's a good news that you solved the compiling error.
I noticed that you were using Ubuntu in VM. So I may assume that your primary OS is Windows.
Actually, this example can be built simply by executing "build.bat" (in the example root) in windows command line.
If you want to do this on Windows:
1 Install DS-5 (need compiler in it) on Windows
2 File compiler path in DS-5, by default it's in "C:\Program Files\DS-5 v5.21.1\sw\ARMCompiler5.05u1\bin"
3 Click Windows "Environment Variables ... " as following picture, in "System variables", find "Variable" "Path", add compiler path to it. Note, paths are seperated by semi-colon.
4 Now command line knows where your compiler is, so execute "build.bat" in example folder
To learn how this project built, you can read "build.bat".
Basically, it produces 2 images: one for normal world, one for secure world.
The secure world image needs normal world image, so normal image is built firstly.
Build normal image:
1 source files:
./src/main_normal.c, ./src/retarget_normal.c, ./src/startup_normal.s, ./src/v7.s
2 scatter file (for ARM tool chain, scatter file is like "linker script in GCC". It tells linker what the layout of output image is. You may refer to the manual of ARM linker - armlink):
scatter_normal.txt
Build secure image:
./src/main_secure.c, ./src/retarget_secure.c, ./src/startup_secure.s, ./src/monitor.s, ./src/v7.s
2 scatter file:
scatter_secure.txt
3 Binary file:
normal.bin
You may notice that, startup_secure.s uses an instruction "INCBIN normal.bin". That caused one of your current error.
It's because secure image need include normal image named "normal.bin" in it. So you have to produce normal.bin firstly by the instructions above.
For more information of "INCBIN", please refer to: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0041c/Caccaghf.html
If you want to build it with DS-5 project, I have some suggestions for you:
1 You need create 2 projects: one for normal, one for secure
2 Add relative source files and scater files to these 2 projects (please refer to the details above to check which files need be added to which project)
3 Build normal images firstly
3 When get normal image - "normal.bin", build secure image
For detailed build paramter, you can refer to "build.bat".
If you just want to use DS-5 for debugging (because use "build.bat" is a very easy way to build), then you can just create a debug session and load axf file from the example path.
It's another topic about debugging.
David
Thank you so much for the reply. I may have missed something. I do not quite make the connection between build.bat and having to create projects for normal image and secure image. I tried the build.bat after I installed and configured DS-5, but I got some errors and I shared them below. I installed DS5 on Windows, and created a 30 day evaluation license. I then created a C project called normal image and added the files ./src/main_normal.c, ./src/retarget_normal.c, ./src/startup_normal.s, ./src/v7.s to the project. I then added the scatter file as a scatter file. I do get some errors as follows:
I also tried to run build.bat after adding the ds-5 to my path and get the following errors even though I generated a 30 day license. I tried to look to see if I can modify something in the build.bat to point to my install, but I do not recognize the path of license desired by the compiler. :
C:\Users\sansari\Downloads\EB_TrustZone_Example\EB_TrustZone_Example>del .\obj\*.o
Could Not Find C:\Users\sansari\Downloads\EB_TrustZone_Example\EB_TrustZone_Example\obj\*.o
C:\Users\sansari\Downloads\EB_TrustZone_Example\EB_TrustZone_Example>armcc -c --debug --cpu=Cortex-A9.no_neon.no_vfp -O1 -o ./obj/main_normal.o ./src/main_normal.c
Error: C9555E: License checkout for feature compiler5 with version 5.0201503 has been denied by Flex back-end. Error code: -1
Cannot find license file.
The license files (or license server system network addresses) attempted are
listed below. Use LM_LICENSE_FILE to use a different license file,
or contact your software provider for a license file.
Feature: compiler5
Filename: c:\program files\arm\licenses\license.dat
License path: c:\program files\arm\licenses\license.dat;
FlexNet Licensing error:-1,359. System Error: 2 "No such file or directory"
For further information, refer to the FlexNet Licensing documentation,
available at "www.flexerasoftware.com".
Product: DS-5 Professional 5.22.0 [5220021]
Component: ARM Compiler 5.05 update 2 (build 169)
Tool: armcc [4d0f38]
C:\Users\sansari\Downloads\EB_TrustZone_Example\EB_TrustZone_Example>armcc -c --debug --cpu=Cortex-A9.no_neon.no_vfp -O1 -o ./obj/retarget_normal.o ./src/retarget_normal.c
C:\Users\sansari\Downloads\EB_TrustZone_Example\EB_TrustZone_Example>armasm --debug --cpu=Cortex-A9.no_neon.no_vfp -o ./obj/startup_normal.o ./src/startup_normal.s
Error: A9555E: License checkout for feature compiler5 with version 5.0201503 has been denied by Flex back-end. Error code: -1
Tool: armasm [4d0f2f]
C:\Users\sansari\Downloads\EB_TrustZone_Example\EB_TrustZone_Example>armasm --debug --cpu=Cortex-A9.no_neon.no_vfp -o ./obj/v7.o ./src/v7.s
C:\Users\sansari\Downloads\EB_TrustZone_Example\EB_TrustZone_Example>armlink --scatter=scatter_normal.txt --entry=normalStart -o normal.axf ./obj/main_normal.o ./obj/retarget_normal.o ./obj/startup_normal.o .
Error: L9555E: License checkout for feature compiler5 with version 5.0201503 has been denied by Flex back-end. Error code: -1
Tool: armlink [4d0f33]
Finished: 1 information, 0 warning and 1 error messages.
C:\Users\sansari\Downloads\EB_TrustZone_Example\EB_TrustZone_Example>fromelf --bin -o normal.bin normal.axf
Error: Q9555E: License checkout for feature compiler5 with version 5.0201503 has been denied by Flex back-end. Error code: -1
Tool: fromelf [4d0f2f]
C:\Users\sansari\Downloads\EB_TrustZone_Example\EB_TrustZone_Example>armcc -c --debug --cpu=Cortex-A9.no_neon.no_vfp -O1 -o ./obj/main_secure.o ./src/main_secure.c
C:\Users\sansari\Downloads\EB_TrustZone_Example\EB_TrustZone_Example>armcc -c --debug --cpu=Cortex-A9.no_neon.no_vfp -O1 -o ./obj/retarget_secure.o ./src/retarget_secure.c
C:\Users\sansari\Downloads\EB_TrustZone_Example\EB_TrustZone_Example>armasm --debug --cpu=Cortex-A9.no_neon.no_vfp -o ./obj/startup_secure.o ./src/startup_secure.s
C:\Users\sansari\Downloads\EB_TrustZone_Example\EB_TrustZone_Example>armasm --debug --cpu=Cortex-A9.no_neon.no_vfp --diag_suppress=A1786W -o ./obj/monitor.o ./src/monitor.s
C:\Users\sansari\Downloads\EB_TrustZone_Example\EB_TrustZone_Example>armlink --scatter=scatter_secure.txt -o EB_TrustZone_Example.axf --entry=secureStart --keep=startup_secure.o(NORMAL_IMAGE) ./obj/main_secur
C:\Users\sansari\Downloads\EB_TrustZone_Example\EB_TrustZone_Example>
For your project build errors:
Seems that object file of v7.S didn't join the linking process, because all missing symbols are defined in v7.S.
I have made a project for normal project, it works well.
Share you some key settings:
1 Project files
2 C compiler setting
3 Assembler setting
4 Linker setting
5 post-build setting (make binary file from axf file)
Then you should pass the build of this project.
Secure project setting is similar.
For the build.bat issue, it seems that you have license issue. I'm using licensed version, so I don't know why it happened in evaluation version.