到这里,代码部分就修改完毕了,还需要修改该的就是Autotools的宏和链接脚本。

为了宏生成速度快,我把其他所有无关的BSP全部删除了。

Autotools宏的修改相对比较简单,文件位置参考以上的连载,有贴出具体目录下的文件。

这里首先修改:

c/src/lib/libbsp/arm/acinclude.am

这个文件修简单,相当于case语句一样,增加一个case语句的分支。让M4宏可以处理该BSP的configure和make.

at9200 ) AC_CONFIG_SUBDIRS([at9200]);;

c/src/lib/libbsp/arm/at9260/Makefile.am

## ## $Id: Makefile.am,v 1.14 2008/08/21 19:33:47 joel Exp $ ## ACLOCAL_AMFLAGS = -I ../../../../aclocal include $(top_srcdir)/../../../../automake/compile.am include $(top_srcdir)/../../bsp.am dist_project_lib_DATA = bsp_specs include_HEADERS = include/bsp.h include_HEADERS += include/tm27.h include_HEADERS += ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/include/at91sam9260.h nodist_include_HEADERS = include/bspopts.h DISTCLEANFILES = include/bspopts.h noinst_PROGRAMS = nodist_include_HEADERS += ../../shared/include/coverhd.h EXTRA_DIST = start/start.S start.$(OBJEXT): start/start.S $(CPPASCOMPILE) -o $@ -c $< project_lib_DATA = start.$(OBJEXT) dist_project_lib_DATA += startup/linkcmds startup_SOURCES = ../../shared/bsplibc.c ../../shared/bsppost.c / ../../shared/bsppredriverhook.c / startup/bspstart.c startup/bspclean.c startup/memmap.c / ../../shared/bootcard.c ../../shared/sbrk.c / ../../shared/gnatinstallhandler.c console_SOURCES = console/uarts.c ../../shared/console.c abort_SOURCES = ../shared/abort/abort.c if HAS_NETWORKING network_CPPFLAGS = -D__INSIDE_RTEMS_BSD_TCPIP_STACK__ noinst_PROGRAMS += network.rel network_rel_SOURCES = network/network.c network_rel_CPPFLAGS = $(AM_CPPFLAGS) $(network_CPPFLAGS) network_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) endif noinst_LIBRARIES = libbsp.a libbsp_a_SOURCES = $(startup_SOURCES) $(console_SOURCES) $(abort_SOURCES) libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/shared/arm920.rel / ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/clock.rel / ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/dbgu.rel / ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/timer.rel / ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/pmc.rel / ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/irq.rel / ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/memcpy.rel if HAS_NETWORKING libbsp_a_LIBADD += network.rel endif include $(srcdir)/preinstall.am include $(top_srcdir)/../../../../automake/local.am

c/src/lib/libbsp/arm/at9260/configure.ac

## Process this file with autoconf to produce a configure script. ## ## configure.ac,v 1.5 2003/03/11 09:39:07 ralf Exp AC_PREREQ(2.60) AC_INIT([rtems-c-src-lib-libbsp-arm-at9260],[_RTEMS_VERSION],[rtems-bugs@OARcorp.com]) AC_CONFIG_SRCDIR([bsp_specs]) RTEMS_TOP(../../../../../..) RTEMS_CANONICAL_TARGET_CPU AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.10]) RTEMS_BSP_CONFIGURE RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm]) RTEMS_CANONICALIZE_TOOLS RTEMS_PROG_CCAS RTEMS_CHECK_NETWORKING AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes") # Explicitly list all Makefiles here AC_CONFIG_FILES([Makefile]) AC_OUTPUT

c/src/lib/libcpu/arm/Makefile.am

## ## $Id: Makefile.am,v 1.12 2008/05/06 20:58:05 joel Exp $ ## ACLOCAL_AMFLAGS = -I ../../../aclocal include $(top_srcdir)/../../../automake/compile.am EXTRA_DIST = noinst_PROGRAMS = ## shared/include if shared include_libcpudir = $(includedir)/libcpu include_libcpu_HEADERS = shared/include/mmu.h ## shared/arm920 noinst_PROGRAMS += shared/arm920.rel shared_arm920_rel_SOURCES = shared/arm920/mmu.c shared_arm920_rel_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/shared/src shared_arm920_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) endif if at91sam9260 include_HEADERS = at91sam9260/include/at91sam9260.h / at91sam9260/include/bits.h ## at91sam9260/clock noinst_PROGRAMS += at91sam9260/clock.rel at91sam9260_clock_rel_SOURCES = at91sam9260/clock/clock.c at91sam9260_clock_rel_CPPFLAGS = $(AM_CPPFLAGS) at91sam9260_clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) ## at91sam9260/dbgu noinst_PROGRAMS += at91sam9260/dbgu.rel at91sam9260_dbgu_rel_SOURCES = at91sam9260/dbgu/dbgu.c at91sam9260_dbgu_rel_CPPFLAGS = $(AM_CPPFLAGS) at91sam9260_dbgu_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) ## at91sam9260/timer noinst_PROGRAMS += at91sam9260/timer.rel at91sam9260_timer_rel_SOURCES = at91sam9260/timer/timer.c at91sam9260_timer_rel_CPPFLAGS = $(AM_CPPFLAGS) at91sam9260_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) ## at91sam9260/pmc noinst_PROGRAMS += at91sam9260/pmc.rel at91sam9260_pmc_rel_SOURCES = at91sam9260/pmc/pmc.c at91sam9260_pmc_rel_CPPFLAGS = $(AM_CPPFLAGS) at91sam9260_pmc_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) ## at91sam9260/interrupt include_HEADERS += at91sam9260/irq/irq.h noinst_PROGRAMS += at91sam9260/irq.rel at91sam9260_irq_rel_SOURCES = at91sam9260/irq/irq.c at91sam9260/irq/bsp_irq_init.c / ../../libbsp/arm/shared/irq/irq_init.c at91sam9260/irq/bsp_irq_asm.S / ../../libbsp/arm/shared/irq/irq_asm.S at91sam9260/irq/irq.h at91sam9260_irq_rel_CPPFLAGS = $(AM_CPPFLAGS) at91sam9260_irq_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) ## at91sam9260/memcpy noinst_PROGRAMS += at91sam9260/memcpy.rel at91sam9260_memcpy_rel_SOURCES = at91sam9260/memcpy/memcpy.S at91sam9260_memcpy_rel_CPPFLAGS = $(AM_CPPFLAGS) at91sam9260_memcpy_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) endif include $(srcdir)/preinstall.am include $(top_srcdir)/../../../automake/local.am

c/src/lib/libcpu/arm/configure.ac

## Process this file with autoconf to produce a configure script. ## ## $Id: configure.ac,v 1.14 2008/05/06 20:58:05 joel Exp $ AC_PREREQ(2.60) AC_INIT([rtems-c-src-lib-libcpu-arm],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla]) AC_CONFIG_SRCDIR([shared]) RTEMS_TOP([../../../../..],[../../..]) RTEMS_CANONICAL_TARGET_CPU AM_INIT_AUTOMAKE([no-define foreign subdir-objects 1.10]) AM_MAINTAINER_MODE RTEMS_ENV_RTEMSBSP RTEMS_PROJECT_ROOT RTEMS_PROG_CC_FOR_TARGET AM_PROG_CC_C_O RTEMS_CANONICALIZE_TOOLS RTEMS_PROG_CCAS AM_CONDITIONAL(shared, test "$RTEMS_CPU_MODEL" = "at91sam9260") AM_CONDITIONAL(at91sam9260, test "$RTEMS_CPU_MODEL" = "at91sam9260") RTEMS_AMPOLISH3 # Explicitly list all Makefiles here AC_CONFIG_FILES([Makefile ]) AC_OUTPUT

再来看看链接脚本。

这个链接脚本是我带以太网缓冲区的链接脚本,但并不影响不带以太网程序的使用。

AT9260的板子上提供了64MB的内存。

虽然AT9260的内部有两个4KB的SRAM,但我尝试使用这两个SRAM,总有这样或者

那样的运行时刻问题,我一怒之下,全部使用SDRAM。没有深究用SRAM为什么会有问题,

前后没有改什么代码,就是调试以太网时,以太网缓冲区在SRAM里转到SDRAM中。

这个问题先记下,还是要再查查。

/* * AT91SAM9260 link script * Bacon Xu */ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(_start) MEMORY { sdram : ORIGIN = 0x20000000, LENGTH = 64M } /* * Declare some sizes. */ _sdram_base = DEFINED(_sdram_base) ? _sdram_base : 0x20000000; _sdram_size = DEFINED(_sdram_size) ? _sdram_size : 64M; _irq_stack_size = DEFINED(_irq_stack_size) ? _irq_stack_size : 0x2000; _fiq_stack_size = DEFINED(_fiq_stack_size) ? _fiq_stack_size : 0x400; _abt_stack_size = DEFINED(_abt_stack_size) ? _abt_stack_size : 0x100; _svc_stack_size = DEFINED(_svc_stack_size) ? _svc_stack_size : 0x2000; SECTIONS { .init : { KEEP (*(.init)) } > sdram /*=0*/ .text : { _text_start = .; CREATE_OBJECT_SYMBOLS *(.text) *(.text.*) /* * Special FreeBSD sysctl sections. */ . = ALIGN (16); __start_set_sysctl_set = .; *(set_sysctl_*); __stop_set_sysctl_set = ABSOLUTE(.); *(set_domain_*); *(set_pseudo_*); /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) *(.gnu.linkonce.t*) *(.glue_7) *(.glue_7t) /* I think these come from the ld docs: */ ___CTOR_LIST__ = .; LONG((___CTOR_END__ - ___CTOR_LIST__) / 4 - 2) *(.ctors) LONG(0) ___CTOR_END__ = .; ___DTOR_LIST__ = .; LONG((___DTOR_END__ - ___DTOR_LIST__) / 4 - 2) *(.dtors) LONG(0) ___DTOR_END__ = .; _etext = .; PROVIDE (etext = .); } > sdram .fini : { KEEP (*(.fini)) } > sdram /*=0*/ .data : { *(.data) *(.data.*) *(.gnu.linkonce.d*) *(.jcr) SORT(CONSTRUCTORS) _edata = .; } > sdram .eh_frame : { *(.eh_frame) } > sdram .data1 : { *(.data1) } > sdram .eh_frame : { *(.eh_frame) } > sdram .gcc_except_table : { *(.gcc_except_table*) } > sdram .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) } > sdram .bss : { /* 256 byte aligned rx buffer header array */ /*. = ALIGN (0x100);*/ at91sam9260_emac_rxbuf_hdrs = .; . += (8 * 512 + 32); at91sam9260_emac_txbuf_hdrs = .; . += (8 * 1 + 32); /* 1 transmit buffer, 0x600 size */ at91sam9260_emac_txbuf = .; . += (2048 + 32); /* 24 receive buffers, 128 each */ at91sam9260_emac_rxbufs = .; . += (128 * 512 + 32); _bss_start_ = .; _clear_start = .; *(.bss) *(.bss.*) *(.gnu.linkonce.b.*) *(COMMON) . = ALIGN(64); _clear_end = .; . = ALIGN (256); _abt_stack = .; . += _abt_stack_size; . = ALIGN (256); _irq_stack = .; . += _irq_stack_size; . = ALIGN (256); _fiq_stack = .; . += _fiq_stack_size; . = ALIGN (256); _svc_stack = .; . += _svc_stack_size; _bss_end_ = .; _end = .; __end = .; /* * Ideally, the MMU's translation table would be in SRAM. But we need * 16K which is the size of SRAM. If we do the mapping right, the TLB * should be big enough that to hold all the translations that matter, * so keeping the table in SDRAM won't be a problem. */ . = ALIGN (16 * 1024); _ttbl_base = .; . += (16 * 1024); . = ALIGN (1024); _bss_free_start = .; } > sdram /* Debugging stuff follows? */ /* Stabs debugging sections. */ .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } .stab.excl 0 : { *(.stab.excl) } .stab.exclstr 0 : { *(.stab.exclstr) } .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) } /* DWARF debug sections. Symbols in the DWARF debugging sections are relative to the beginning of the section so we begin them at 0. */ /* DWARF 1 */ .debug 0 : { *(.debug) } .line 0 : { *(.line) } /* GNU DWARF 1 extensions */ .debug_srcinfo 0 : { *(.debug_srcinfo) } .debug_sfnames 0 : { *(.debug_sfnames) } /* DWARF 1.1 and DWARF 2 */ .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } /* DWARF 2 */ .debug_info 0 : { *(.debug_info) } .debug_abbrev 0 : { *(.debug_abbrev) } .debug_line 0 : { *(.debug_line) } .debug_frame 0 : { *(.debug_frame) } .debug_str 0 : { *(.debug_str) } .debug_loc 0 : { *(.debug_loc) } .debug_macinfo 0 : { *(.debug_macinfo) } /* SGI/MIPS DWARF 2 extensions */ .debug_weaknames 0 : { *(.debug_weaknames) } .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } /* .stack 0x80000 : { _stack = .; *(.stack) }*/ /* These must appear regardless of . */ }

这一切全部修改该完毕后,我们就开始编译啦,首先进入开发系统:

export PATH=/opt/rtems-4.9/bin:$PATH

然后进入顶层的源代码目录夹,运行以下三条命令:

./bootstrap -c

./bootstrap -p

./bootstrap

注意提示,如果出现异常请检查我们改写的autotools的宏是否有问题。

然后建立一个at9260文件夹用于编译。

mkdir at9260

cd at9260

../configure --target=arm-rtems4.9 --disable-posix --disable-cxx --disable-networking --enable-rtemsbsp=at9260 --prefix=/opt/rtems-4.9

make

make install

如果编译成功,恭喜,那我们可以从官方网站上下载个例子来试试了。

如果没编译成功,请不要放弃,仔细检查每个环节,是否是哪里出问题了。如果是编译的过程中出问题,请仔细检查代码,一点点修改。

如果您对我说的方法有异议,请联系我。谢谢。

下回聊聊如何搞定 Helloworld!!!

转载于:https://blog.51cto.com/coolbacon/1280032

RTEMS 的 AT91SAM9260 移植(8): 编译相关推荐

  1. RTEMS 的 AT91SAM9260 移植(5): 调试串口驱动

    其实到这里,只要能保证编译通过,再修改一下链接脚本,其实已经可以跑在at9260的系统上了.因为我没有仿真器,不知道程序的状态,所以必须撰写调试串口的驱动. RTEMS 的调试串口并没有采用中断输出的 ...

  2. 嵌入式linux alsa,嵌入式Linux下ALSA音频架构ALSA-lib移植与编译心得

    **************************************************************************************************** ...

  3. 安卓高通机型的基带移植 修改 编译的相关 增加信号 支持5G等【二】

    安卓高通机型的基带移植 修改 编译的相关 增加信号 支持5G等[一] 前面分享了这篇帖子,很多友友希望更新下新机型的基带替换方法.今天对其中做一些补充说明.由于安卓机型跨版本幅度较大.有的机型从出厂安 ...

  4. ION-DTN在RTEMS上的移植

    ION-DTN是DTN协议栈的具体实现,广泛应用在深空通信等恶劣环境下,RTEMS作为星载操作系统之一,若能在RTEMS上实现DTN协议栈,能够为RTEMS的提供更为广泛的应用. 接下来详细描述如何将 ...

  5. 关于移植jSON编译时报错sbrkr.c:(.text+0xc): undefined reference to `_sbrk'处理

    最近有个项目需要用到jSON函数,在移植了jSON后编译报错如下:sbrkr.c:(.text+0xc): undefined reference to `_sbrk'. 通过百度查询知道原来是GCC ...

  6. 【IMX6UL开发板试用体验】OpenWRT在iMX6UL上面的移植与编译

    选择 OpenWRT在最近的时期分裂出了LEDE出来,因此这就涉及到了这两个的选择. 前段时间,编译过LEDE用于树莓派3,于是想着直接使用以前的LEDE,这样子省去了下载,毕竟在国内下载很多sour ...

  7. (转)speex详细介绍--概念、移植、编译、命令行等

    Speex之一-介紹Speex 介紹Speex Speex編解碼器(www.speex.org)存在是因為有這麼一個需求,即是開源同時專利版權也是免費的.這應該也是各開源軟體的必要條件.本質上講,Sp ...

  8. iMX6UL之 OpenWRT移植与编译

    选择 OpenWRT在最近的时期分裂出了LEDE出来,但还是决定使用OpenWRT,并且使用master上面新的代码来移植编译. OpenWRT配置 本身LEDE与OpenWRT里面已经有一个imx6 ...

  9. linux vim编辑kconfig 无法wq,Linux-4.9.2内核在mini2440上的移植(三)——编译环境测试...

    原因:没有安装make工具,安装一下 root@ubuntu:~/linux-4.9.2#apt  install  make 再重试,又出错 root@ubuntu:~/linux-4.9.2#ma ...

最新文章

  1. PAT (Advanced Level) 1014. Waiting in Line (30)
  2. 反射工具类 java_Java反射工具类
  3. 【Elasticsearch】解决Elasticsearch HTTP方式查询报SocketTimeoutException的问题 Connection reset by peer
  4. 【clickhouse】clickhouse 配置 安装目录
  5. Linux下iptables屏蔽IP和端口号
  6. 《LoadRunner性能测试巧匠训练营》——1.4 性能测试分类详解
  7. 3D数学之快速傅立叶变换(Fast Fourier Transform-FFT)
  8. 数据清洗(根据元素匹配选取数据)
  9. torch中permute()函数用法补充内容(矩阵维度变化详细过程)
  10. MapGIS干货|数据投影生成地质图的8个视频教程
  11. 虎牙代理php,huya虎牙PHP
  12. Windows 11 LTSC 数字激活方法/HEU KMS Activator 数字激活/LTSC公key激活
  13. 很全的zencart 模板修改
  14. 新浪邮箱界面登录按钮效果制作
  15. Matplotlib绘制春节休假表
  16. W3C school
  17. 哪一种编程语言适合人工智能
  18. 抖音运营 | 10万赞的短视频如何打造?
  19. KaTex 数学公式 基础
  20. JQuery语法知识

热门文章

  1. ppt android sdk,《0.AndroidSDK概述.ppt
  2. 微信摇一摇插件ios_iOS实现微信摇一摇功能
  3. nginx配置websocket转发功能
  4. Consumer接口练习之按要求打印信息
  5. Supplier接口练习之获取最大值
  6. pom文件内标签的讲解
  7. 测试发送消息和接受消息
  8. MapReduce-流量统计求和-排序-JobMain代码和测试运行
  9. 角色操作-查询所有角色代码实现
  10. 使用域名访问后台页面