Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Adding a target type for embedded development?
WinterMute:
Hi,
Sorry to take so long replying. Only just noticed you'd replied.
Currently I'm using a custom Makefile to build which works fine regardless of the target type. The problem comes when attempting to use code::blocks build system where the link step for the console and native targets just use the linker to output the final file.
Here's the build log with my Makefile for a 3DS homebrew application.
--- Code: ----------------- Build: Debug in 3dstest1 (compiler: devkitARM)---------------
Checking if target is up-to-date: make.exe -q -f Makefile Debug
Running command: make.exe -f Makefile Debug
main.c
arm-none-eabi-gcc -MMD -MP -MF /c/Users/davem_000/projects/test/3dstest1/Debug/main.d -g -Wall -O2 -mword-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=softfp -I/c/Users/davem_000/projects/test/3dstest1/include -I/c/devkitPro/libctru/include -I/c/Users/davem_000/projects/test/3dstest1/build -DARM11 -D_3DS -c /c/Users/davem_000/projects/test/3dstest1/source/main.c -o main.o
arm-none-eabi-gcc -specs=3dsx.specs -g -march=armv6k -mtune=mpcore -mfloat-abi=softfp -Wl,-Map,3dstest1-debug.map main.o -L/c/devkitPro/libctru/lib -lctru -lm -o /c/Users/davem_000/projects/test/3dstest1/3dstest1-debug.elf
arm-none-eabi-nm -CSn /c/Users/davem_000/projects/test/3dstest1/3dstest1-debug.elf > 3dstest1-debug.lst
3dsxtool /c/Users/davem_000/projects/test/3dstest1/3dstest1-debug.elf /c/Users/davem_000/projects/test/3dstest1/3dstest1-debug.3dsx
smdhtool --create "3dstest1-debug" "Built with devkitARM & ctrulib" "Unspecified Author" /c/devkitPro/libctru/default_icon.png /c/Users/davem_000/projects/test/3dstest1/3dstest1-debug.smdh
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
--- End code ---
And here's what it does if I switch off the custom Makefile option
--- Code: ---
-------------- Build: Debug in 3dstest1 (compiler: devkitARM)---------------
arm-none-eabi-gcc.exe -march=armv6k -mtune=mpcore -mfloat-abi=softfp -g -Wall -O2 -mword-relocations -Ic:\devkitPro\devkitARM\..\libctru\include -Ic:\devkitPro\devkitARM\arm-none-eabi\include -c source\main.c -o obj\Debug\source\main.o
arm-none-eabi-g++.exe -Lc:\devkitPro\devkitARM\..\libctru\lib -o 3dstest1-debug.3dsx obj\Debug\source\main.o -specs=3dsx.specs -lctru
Output file is 3dstest1-debug.3dsx with size 211.99 KB
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
--- End code ---
So what I was intending to do is have the ttEmbedded target link an elf and then another script which performs the steps that build the final binary and/or support files. These final steps will be different for each platform devkitARM supports.
If that makes any sense ...
scarphin:
You can change the output extension to .elf in 'project->properties->build targets->output filename' and then use post-build steps to build the final output binaries and/or other files if I understood your problem correctly. You can also consult the avr project wizard as it performs similar build and post-build steps for an avr project, just create a dummy avr project and check the project settings for further reference.
WinterMute:
If I change the extension to .elf then the run and debug buttons don't work. The main point of this was to be able to launch an emulator to run the final binary with the run button. The debug button launches the emulator with a gdb port & starts gdb which connects to that.
This could also work with an application to upload binaries to, in my case, a game console & work in the same way there.
oBFusCATed:
Then what about my proposal to add host app for every possible target type?
WinterMute:
OK, I've played around with this some more and it'll work for me if the native target can use the host application.
This patch uses the Host Application to run ttNative target if it's set and also fixes the static & dynamic lib targets so variables can be used in the execution parameters. This should also work for the guy with the MPI program.
I'm wondering if it would be better to just the ReplaceEnvVars method on the completed command string though.
What do you think about going this way?
--- Code: ---diff --git a/src/plugins/compilergcc/compilergcc.cpp b/src/plugins/compilergcc/compilergcc.cpp
index f435b8c..3ceeefe 100644
--- a/src/plugins/compilergcc/compilergcc.cpp
+++ b/src/plugins/compilergcc/compilergcc.cpp
@@ -1911,19 +1911,28 @@ int CompilerGCC::Run(ProjectBuildTarget* target)
m_pProject->SetCurrentlyCompilingTarget(0);
return -1;
}
- Manager::Get()->GetMacrosManager()->ReplaceEnvVars(hostapStr);
command << hostapStr << strSPACE;
command << target->GetExecutionParameters();
+ Manager::Get()->GetMacrosManager()->ReplaceEnvVars(command);
}
else if (target->GetTargetType() != ttCommandsOnly)
{
- command << execStr << strSPACE;
- command << target->GetExecutionParameters();
- // each shell execution must be enclosed to "":
- // xterm -T X -e /bin/sh -c "/usr/bin/cb_console_runner X"
- // here is last \"
- if (commandIsQuoted)
- command << strQUOTE;
+ if (target->GetTargetType() == ttNative && !target->GetHostApplication().IsEmpty())
+ {
+ command << hostapStr << strSPACE;
+ command << target->GetExecutionParameters();
+ Manager::Get()->GetMacrosManager()->ReplaceEnvVars(command);
+ }
+ else
+ {
+ command << execStr << strSPACE;
+ command << target->GetExecutionParameters();
+ // each shell execution must be enclosed to "":
+ // xterm -T X -e /bin/sh -c "/usr/bin/cb_console_runner X"
+ // here is last \"
+ if (commandIsQuoted)
+ command << strQUOTE;
+ }
}
else
{
--- End code ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version