Atmel Studio 7 - ASF and C++

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

 

I will start a new project with a SAM4E8C in the Atmel Studio 7 with the ASF and C++.

But when I create a C++ executable Project and add an user board template then the build end into an error:

------ Build started: Project: ASF_CPP, Configuration: Debug ARM ------
Build started.
Project "ASF_CPP.cppproj" (default targets):
Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').
Target "CoreBuild" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Compiler.targets" from project "D:\Eigene Datein\Documents\Atmel Studio\7.0\TestCPP\ASF_CPP\ASF_CPP.cppproj" (target "Build" depends on it):
	Task "RunCompilerTask"
		Shell Utils Path C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils
		C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils\make.exe all 
		Building file: ../src/ASF/sam/utils/cmsis/sam4e/source/templates/system_sam4e.c
		Invoking: ARM/GNU C Compiler : 4.9.3
		"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe"  -x c -mthumb -D__SAM4E8C__ -DDEBUG -Dscanf=iscanf -DBOARD=USER_BOARD -DARM_MATH_CM4=true -Dprintf=iprintf  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAM4E_DFP\1.1.30\ic.sam4e\include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\cmsis\4.2.0\CMSIS\Include" -I"../common/applications/user_application/user_board/config" -I"../src/config" -I"../src/ASF/thirdparty/CMSIS/Lib/GCC" -I"../src/ASF/common/utils" -I"../src" -I"../src/ASF/sam/utils/fpu" -I"../src/ASF/sam/utils" -I"../src/ASF/sam/utils/preprocessor" -I"../src/ASF/sam/utils/cmsis/sam4e/include" -I"../src/ASF/common/boards" -I"../src/ASF/sam/utils/header_files" -I"../src/ASF/common/boards/user_board" -I"../src/ASF/thirdparty/CMSIS/Include" -I"../src/ASF/sam/utils/cmsis/sam4e/source/templates"  -O1 -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m4 -c -pipe -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror-implicit-function-declaration -Wpointer-arith -std=gnu99 -ffunction-sections -fdata-sections -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wbad-function-cast -Wwrite-strings -Wsign-compare -Waggregate-return -Wmissing-declarations -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs -Wlong-long -Wunreachable-code -Wcast-align --param max-inline-insns-single=500 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -MD -MP -MF "src/ASF/sam/utils/cmsis/sam4e/source/templates/system_sam4e.d" -MT"src/ASF/sam/utils/cmsis/sam4e/source/templates/system_sam4e.d" -MT"src/ASF/sam/utils/cmsis/sam4e/source/templates/system_sam4e.o"   -o "src/ASF/sam/utils/cmsis/sam4e/source/templates/system_sam4e.o" "../src/ASF/sam/utils/cmsis/sam4e/source/templates/system_sam4e.c" 
		../src/ASF/sam/utils/cmsis/sam4e/source/templates/system_sam4e.c: In function 'SystemInit':
D:\Eigene Datein\Documents\Atmel Studio\7.0\TestCPP\ASF_CPP\src\ASF\sam\utils\cmsis\sam4e\source\templates\system_sam4e.c(66,32): error: 'CKGR_MOR_KEY_PASSWD' undeclared (first use in this function)
		 #define SYS_CKGR_MOR_KEY_VALUE CKGR_MOR_KEY_PASSWD/* Key to unlock MOR register */
		                                ^
D:\Eigene Datein\Documents\Atmel Studio\7.0\TestCPP\ASF_CPP\src\ASF\sam\utils\cmsis\sam4e\source\templates\system_sam4e.c(81,19): info: in expansion of macro 'SYS_CKGR_MOR_KEY_VALUE'
		   PMC->CKGR_MOR = SYS_CKGR_MOR_KEY_VALUE | SYS_BOARD_OSCOUNT |
		                   ^
D:\Eigene Datein\Documents\Atmel Studio\7.0\TestCPP\ASF_CPP\src\ASF\sam\utils\cmsis\sam4e\source\templates\system_sam4e.c(66,32): info: each undeclared identifier is reported only once for each function it appears in
		 #define SYS_CKGR_MOR_KEY_VALUE CKGR_MOR_KEY_PASSWD/* Key to unlock MOR register */
		                                ^
D:\Eigene Datein\Documents\Atmel Studio\7.0\TestCPP\ASF_CPP\src\ASF\sam\utils\cmsis\sam4e\source\templates\system_sam4e.c(81,19): info: in expansion of macro 'SYS_CKGR_MOR_KEY_VALUE'
		   PMC->CKGR_MOR = SYS_CKGR_MOR_KEY_VALUE | SYS_BOARD_OSCOUNT |
		                   ^
		make: *** [src/ASF/sam/utils/cmsis/sam4e/source/templates/system_sam4e.o] Error 1
	Done executing task "RunCompilerTask" -- FAILED.
Done building target "CoreBuild" in project "ASF_CPP.cppproj" -- FAILED.
Done building project "ASF_CPP.cppproj" -- FAILED.

Build FAILED.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

 

I also tried to create a C library project with the ASF code and add this library in a CPP executable project. But this doesn't work.

http://asf.atmel.com/bugzilla/show_bug.cgi?id=2838#c7

 

And this:

http://onyxibex.com/2014/07/asf-...

doesn't also not work. :(

 

Have anybody an idea or a solution, how I can use the ASF and C++ in Atmel Studio 7?

 

Thanks!

godi

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello. I have same problem wiht *.o objects, but I use C project. 

make: *** [src/ASF/sam/utils/cmsis/sam4e/source/templates/*.o] Error 1

PLEASE HELLP US

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

I think your C++ complier is missing some Defines from the commandline.

Go to the project properties and check "ARM/GNU C Compiler" and look at the sub entry Symbols.

There will be stuff like "ARM_MATH_CM7=true". (Edit: as example, actual values depend on the choosen device...)

Make sure to add the same stuff to the "ARM/GNU C++ Compiler" -> Symbols.

 

Also you will probably run into some linker errors. Some .h files in ASF are missing

#ifdef __cplusplus
extern "C" {
#endif

....

#ifdef __cplusplus
}
#endif

 

Good luck wink

 

Last Edited: Wed. Oct 12, 2016 - 06:31 PM