SDCC安装指南

参考网址: https://github.com/g-oikonomou/contiki-sensinode/wiki/Prepare-your-System

A more up-to-date version of this guide can be found on the contiki wiki. In case of conflicting information, the Contiki wiki wins.

In order to compile contiki, you need a version of the SDCC compiler. Unfortunately, the binary packages don't contain all the libraries we need so you will have to compile SDCC from sources.

Information on this page has been tested on Ubuntu and on Mac OS X. Things should work on Cygwin but may require some tweaking.

Before anything else, make sure you don't have a pre-installed version from the Ubuntu archive!

Make sure you have the following installed:

SDCC supports various device types. You can compile it with support for all of them or only some. The port of interest to us is the mcs51. Disabling all other ports will make the compile considerably faster.

Recent Tested SDCC revisions: 7100

  • Download a recommended revision from the SDCC svn (replace [rev] with one of the numbers above):

svn co -r [rev] https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc

  • cd into the extracted directory. This will be called sdcc
  • Now you need to hack sdcc's build system a bit, in order to get correct library versions.
    • You can do this manually:
      • Edit device/lib/incl.mk.
        We need model-huge and model-large libraries. To instruct the build system to build model-huge libraries, find this line:
        MODELS = small medium large.
        Add huge. You may remove small and medium if you only use SDCC for contiki, but make sure you keep large. So your new line may end up looking like this:
        MODELS = small large huge.
      • Edit device/lib/Makefile.in. Find this line:
        TARGETS += models small-mcs51-stack-auto.
        Replace it with this:
        TARGETS += models model-mcs51-stack-auto
    • Or you can apply this patch.
      • Download and save it to the sdcc directory.
      • Patch sdcc: patch -p0 < contiki-sdcc.patch
  • Run
  • ./configure --disable-gbz80-port --disable-z80-port --disable-ds390-port --disable-ds400-port --disable-pic14-port --disable-pic16-port --disable-hc08-port --disable-r2k-port --disable-z180-port --disable-sdcdb --disable-ucsim 

    • If you don't have root access you will probably want to change the installation directory. You can do that with the --prefix=dir option of the ./configure stage.
    • If you get any errors about missing packages, fix them.
  • make
  • make install as root or with sudo

You now have a working compiler and libraries. The sdcc executable might be outside the PATH, depending where you installed it. Try running sdcc -v and see if it's in the PATH. If not, add it. If sdcc is in the PATH and you have compiled excluding unused ports, sdcc -v will show you something like this:

SDCC : mcs51 3.0.6 #7000 (Nov 1 2011) (Linux)

The list of supported ports appears after the : and before the version number. If you build everything this message will be a lot longer.


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值