cross compiling with sdcc

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

cross compiling with sdcc

Torsten Robitzki
Hello,
I was looking for some resources on how to configure cmake to use the small device c compiler (sdcc). I tried a little bit and found that cmake assumed that the object file extension would be .obj. But sdcc uses .rel for object files. I’ve searched a lot in the web and the cmake sources, tried to figure out, how the compiler detection mechanism works.

I saw that there is a file Platform/Generic-SDCC-C.cmake, while searching for a way to force cmake to use this file, I found a makro CMAKE_FORCE_C_COMPILER that let me override the compiler detection.

So now I have a working solution and wonder if that solution is one „correct“ solution. „correct“ in terms of supported and intended by the developers.

    cmake_minimum_required(VERSION 3.2)
    include (CMakeForceCompiler)
    set(CMAKE_SYSTEM_NAME Generic)
    CMAKE_FORCE_C_COMPILER(sdcc SDCC)

    project(test C)

Does this looks reasonable? Thank you very much for your time!

Kind regards,

Torsten

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cross compiling with sdcc

Alexander Neundorf-3
On Friday, May 29, 2015 11:14:06 [hidden email] wrote:

> Hello,
> I was looking for some resources on how to configure cmake to use the small
> device c compiler (sdcc). I tried a little bit and found that cmake assumed
> that the object file extension would be .obj. But sdcc uses .rel for object
> files. I’ve searched a lot in the web and the cmake sources, tried to
> figure out, how the compiler detection mechanism works.
>
> I saw that there is a file Platform/Generic-SDCC-C.cmake, while searching
> for a way to force cmake to use this file, I found a makro
> CMAKE_FORCE_C_COMPILER that let me override the compiler detection.
>
> So now I have a working solution and wonder if that solution is one
> „correct“ solution. „correct“ in terms of supported and intended by the
> developers.
>
>     cmake_minimum_required(VERSION 3.2)
>     include (CMakeForceCompiler)
>     set(CMAKE_SYSTEM_NAME Generic)
>     CMAKE_FORCE_C_COMPILER(sdcc SDCC)
>
>     project(test C)
>
> Does this looks reasonable? Thank you very much for your time!

you shouldn't have  to use cmake_force_c_compiler().
You did try setting up a toolchain file which points to sdcc ?

Alex

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cross compiling with sdcc

Torsten Robitzki
Hi Alex,
Am 13.06.2015 um 22:18 schrieb Alexander Neundorf <[hidden email]>:

> On Friday, May 29, 2015 11:14:06 [hidden email] wrote:

>> I saw that there is a file Platform/Generic-SDCC-C.cmake, while searching
>> for a way to force cmake to use this file, I found a makro
>> CMAKE_FORCE_C_COMPILER that let me override the compiler detection.
> …
> you shouldn't have  to use cmake_force_c_compiler().
> You did try setting up a toolchain file which points to sdcc ?

could you elaborate on this solution? Would the Platform/Generic-SDCC-C.cmake file that is shipped with a normal cmake installation such a toolchain file?

kind regards,

Torsten
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cross compiling with sdcc

Alexander Neundorf-3
On Saturday, June 13, 2015 23:26:59 [hidden email] wrote:

> Hi Alex,
>
> Am 13.06.2015 um 22:18 schrieb Alexander Neundorf <[hidden email]>:
> > On Friday, May 29, 2015 11:14:06 [hidden email] wrote:
> …
>
> >> I saw that there is a file Platform/Generic-SDCC-C.cmake, while searching
> >> for a way to force cmake to use this file, I found a makro
> >> CMAKE_FORCE_C_COMPILER that let me override the compiler detection.
> >
> > …
> > you shouldn't have  to use cmake_force_c_compiler().
> > You did try setting up a toolchain file which points to sdcc ?
>
> could you elaborate on this solution? Would the
> Platform/Generic-SDCC-C.cmake file that is shipped with a normal cmake
> installation such a toolchain file?


here is some documentation on this:
http://www.cmake.org/cmake/help/v3.2/manual/cmake-toolchains.7.html

Alex

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake