I'm trying to make a new project at Eclipse to my AT91sam9260 board.
This project is based on two atmel examples: basic-ssc-i2s and basic-emac-uip-telnet.
But when I'm working with these examples together, appear the error below:
make: * [sdram] Error 1
I don't know why, I've been thinking about and I think that is because has some error at Makefile file!
Anyone could help me?
Thank
The makefile:
CHIP = at91sam9260
BOARD = at91sam9260-ek
# Trace level used for compilation
# (can be overriden by adding TRACE_LEVEL=#number to the command-line)
TRACE_LEVEL = 4
# Optimization level, put in comment for debugging
#OPTIMIZATION = -Os
# AT91 library directory
AT91LIB = ../at91lib
# Output file basename
OUTPUT = basic-ssc-i2s-at73c213-project-$(BOARD)-$(CHIP)
# Compile for all memories available on the board (this sets $(MEMORIES))
include $(AT91LIB)/boards/$(BOARD)/board.mak
# Output directories
BIN = bin
OBJ = obj
#-------------------------------------------------------------------------------
# Tools
#-------------------------------------------------------------------------------
# Tool suffix when cross-compiling
CROSS_COMPILE = arm-none-eabi-
# Compilation tools
CC = $(CROSS_COMPILE)gcc
SIZE = $(CROSS_COMPILE)size
STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy
# Flags
INCLUDES = -I$(AT91LIB)/boards/$(BOARD) -I$(AT91LIB)/peripherals
INCLUDES += -I$(AT91LIB)/components -I$(AT91LIB) -I.
CFLAGS = -Wall -mlong-calls -mstructure-size-boundary=8 -ffunction-sections
CFLAGS += -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -DTRACE_LEVEL=$(TRACE_LEVEL)
ASFLAGS = -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D__ASSEMBLY__
LDFLAGS = -g $(OPTIMIZATION) -nostartfiles -Wl,--gc-sections
#-------------------------------------------------------------------------------
# Files
#-------------------------------------------------------------------------------
# Directories where source files can be found
PERIPH = $(AT91LIB)/peripherals
BOARDS = $(AT91LIB)/boards
UTILITY = $(AT91LIB)/utility
COMP = $(AT91LIB)/components
# uIP library directory
UIPLIB = ../external_libs/ethernet/uip
VPATH += $(COMP)/dac-at73c213
VPATH += $(COMP)/ethernet/dm9161
VPATH += $(UTILITY)
VPATH += $(PERIPH)/dbgu $(PERIPH)/pio $(PERIPH)/aic $(PERIPH)/ssc $(PERIPH)/spi $(PERIPH)/pmc
VPATH += $(PERIPH)/cp15 $(PERIPH)/emac $(PERIPH)/rstc $(PERIPH)/usart $(PERIPH)/tc
VPATH += $(BOARDS)/$(BOARD) $(BOARDS)/$(BOARD)/$(CHIP)
VPATH += $(UIPLIB)/uip
VPATH += $(UIPLIB)/lib
VPATH += $(UIPLIB)/apps/dhcpc
#VPATH += $(UIPLIB)/apps/telnetd
INCLUDES += -I$(UTILITY)
INCLUDES += -I$(UIPLIB)/uip
INCLUDES += -I$(UIPLIB)/lib
INCLUDES += -I$(UIPLIB)/apps/dhcpc
#INCLUDES += -I$(UIPLIB)/apps/telnetd
# Objects built from C source files
C_OBJECTS = main.o
C_OBJECTS += at73c213.o dm9161.o protocol.o
C_OBJECTS += wav.o stdio.o math.o emac.o rstc.o tc.o usart.o
C_OBJECTS += dbgu.o pio.o ssc.o aic.o spi.o pmc.o cp15.o
C_OBJECTS += board_memories.o board_lowlevel.o
#UIP:
#lib
C_OBJECTS += memb.o
#uip
C_OBJECTS += psock.o timer.o uip.o uip_arp.o
#main
C_OBJECTS += clock-arch.o tapdev.o
#dhcp
C_OBJECTS += dhcpc.o
#telnetd
#C_OBJECTS += shell.o telnetd.o
# Objects built from Assembly source files
ASM_OBJECTS = board_cstartup.o
ASM_OBJECTS += cp15_asm.o
# Append OBJ and BIN directories to output filename
OUTPUT := $(BIN)/$(OUTPUT)
#-------------------------------------------------------------------------------
# Rules
#-------------------------------------------------------------------------------
all: $(BIN) $(OBJ) $(MEMORIES)
$(BIN) $(OBJ):
mkdir $#
define RULES
C_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(C_OBJECTS))
ASM_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(ASM_OBJECTS))
$(1): $$(ASM_OBJECTS_$(1)) $$(C_OBJECTS_$(1))
$(CC) $(LDFLAGS) -T"$(AT91LIB)/boards/$(BOARD)/$(CHIP)/$$#.lds" -o $(OUTPUT)-$$#.elf $$^
$(OBJCOPY) -O binary $(OUTPUT)-$$#.elf $(OUTPUT)-$$#.bin
$(SIZE) $$^ $(OUTPUT)-$$#.elf
$$(C_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN)
$(CC) $(CFLAGS) -D$(1) -c -o $$# $$<
$$(ASM_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.S Makefile $(OBJ) $(BIN)
$(CC) $(ASFLAGS) -D$(1) -c -o $$# $$<
debug_$(1): $(1)
perl ../resources/gdb/debug.pl $(OUTPUT)-$(1).elf
endef
$(foreach MEMORY, $(MEMORIES), $(eval $(call RULES,$(MEMORY))))
clean:
-rm -f $(OBJ)/*.o $(BIN)/*.bin $(BIN)/*.elf
Related
What are the required steps to use a distro layer in Yocto?
Currently, I have the following setup:
meta-my-distro-layer/conf/distro/mydistro.conf:
DISTROOVERRIDES =. "poky:"
require conf/distro/poky.conf
DISTRO = "mydistro"
DISTRO_NAME = "MyDistro"
DISTRO_VERSION = "1.0"
DISTRO_CODENAME = "one"
INIT_MANAGER = "systemd"
meta-my-distro-layer/conf/layer.conf
# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"
# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "meta-my-distro-layer"
BBFILE_PATTERN_meta-my-distro-layer = "^${LAYERDIR}/"
BBFILE_PRIORITY_meta-my-distro-layer = "6"
LAYERDEPENDS_meta-my-distro-layer = "core"
LAYERSERIES_COMPAT_meta-my-distro-layer = "kirkstone"
meta-my-distro-layer/recipes-core/images/console-image.bb
DESCRIPTION = "A console-only image"
IMAGE_FEATURES += "ssh-server-openssh"
IMAGE_INSTALL = "\
packagegroup-core-boot \
packagegroup-core-full-cmdline \
${CORE_IMAGE_EXTRA_INSTALL} \
"
inherit core-image
IMAGE_INSTALL += "curl"
build/conf/bblayers.conf:
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
/my-work-dir/poky/meta \
/my-work-dir/poky/meta-poky \
/my-work-dir/poky/meta-yocto-bsp \
/my-work-dir/poky/meta-my-distro-layer \
"
I can build the console image defined in that layer, but nothing set in mydistro.conf seems to have any effect on bitbake. According to bitbake -e, DISTRO and INIT_MANAGER never get set to my values and (consequently) trying to set INIT_MANAGER to systemd never takes effect. I can set INIT_MANAGER in conf/local.conf and it takes effect then, but I'd like to do that in a distro layer.
You need to set DISTRO to mydistro in local.conf
In my makefile there is a variable that contains all source files:
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
I now want to create a DEPFILES that contains the same files as SOURCES with two main differences:
Each file ends with ".d" instead of ".c"
Each file contains a "." before its basename, such that the resulting file is hidden.
I came up with this expression, which works well:
DEPFILES := $(foreach s,$(SOURCES:.$(SRCEXT)=.$(DEPSEXT)),$(shell echo $(s) | sed -e 's/^\(.*\/\)/\1./')))
Initially, I split SOURCES into the following lists:
PRE := $(dir $(SOURCES))
SUF := $(addprefix ".", $(notdir $(SOURCES)))
Question: How do you join those two lists in a makefile, such that the results equals DEPFILES? In other words: How do you pairwisely concat the strings from both lists?
Here is a simpler approach using makefile only and no shell - if I understood your requirement ok:
SRCS += bob/src1.c fred/src2.c src3.c
DEPS=$(join $(addsuffix ., $(dir $(SRCS))), $(notdir $(SRCS:.c=.d)))
# Some debug:
$(info 1. $(SRCS))
$(info 2. $(SRCS:.c=.d))
$(info 3. $(notdir $(SRCS:.c=.d)))
$(info 4. $(dir $(SRCS)))
.PHONY: all
all:
#echo SRCS: $(SRCS)
#echo DEPS: $(DEPS)
I broke the output down into steps so you can see what each part does - saves me to explain it!
outputs:
1. bob/src1.c fred/src2.c src3.c
2. bob/src1.d fred/src2.d src3.d
3. src1.d src2.d src3.d
4. bob/ fred/ ./
SRCS: bob/src1.c fred/src2.c src3.c
DEPS: bob/.src1.d fred/.src2.d ./.src3.d
I am working with Yocto 2.4.2 (rocko), Ubuntu 14.04 LTS, Linux kernel LTSI 4.4, arm cortexA15. There are many issues while building core-image-weston. One of them is:
ERROR: core-image-weston-1.0-r0 do_rootfs: Unable to install packages. Command '/home/server-build/RZG_YoctoProject/build/tmp/work/iwg20m-poky-linux-gnueabi/core-image-weston/1.0-r0/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f /home/server-build/RZG_YoctoProject/build/tmp/work/iwg20m-poky-linux-gnueabi/core-image-weston/1.0-r0/opkg.conf -t /home/server-build/RZG_YoctoProject/build/tmp/work/iwg20m-poky-linux-gnueabi/core-image-weston/1.0-r0/temp/ipktemp/ -o /home/server-build/RZG_YoctoProject/build/tmp/work/iwg20m-poky-linux-gnueabi/core-image-weston/1.0-r0/rootfs --force_postinstall --prefer-arch-to-version install
libkms1
run-postinsts
gstreamer1.0-plugins-good-video4linux2
weston
opkg
psplash
libclutter-1.0-examples
alsa-tools
gtk+3-demo
gles-user-module
packagegroup-core-boot
libdrm-tests
kernel-module-gles
alsa-utils
weston-init
packagegroup-base-extended
bash
packagegroup-core-ssh-dropbear'
returned 2:
Collected errors:
* Solver encountered 2 problem(s):
* Problem 1/2:
- nothing provides libgbm >= 1.0 needed by weston-2.0.0-r0.cortexa15hf-neon
* Solution 1:
- do not ask to install a package providing weston
* Problem 2/2:
- nothing provides libgbm >= 1.0 needed by weston-2.0.0-r0.cortexa15hf-neon
* Solution 1:
- do not ask to install a package providing weston-init
ERROR: core-image-weston-1.0-r0 do_rootfs: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /home/server-build/RZG_YoctoProject/build/tmp/work/iwg20m-poky-linux-gnueabi/core-image-weston/1.0-r0/temp/log.do_rootfs.20697
ERROR: Task (/home/server-build/RZG_YoctoProject/build/../poky/meta/recipes-graphics/images/core-image-weston.bb:do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3411 tasks of which 3410 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/home/server-build/RZG_YoctoProject/build/../poky/meta/recipes-graphics/images/core-image-weston.bb:do_rootfs
The packages weston and weston-init require libgbm >= 1.0. In our current system, libgbm.bb was already existent. And, I can build libgbm succesfully.
SUMMARY = "gbm library"
LICENSE = "MIT"
SECTION = "libs"
LIC_FILES_CHKSUM = "file://gbm.c;beginline=4;endline=22;md5=5cdaac262c876e98e47771f11c7036b5"
SRCREV = "84984e873a134ee67b4c99859f052bb42834245c"
SRC_URI = "git://github.com/thayama/libgbm;protocol=git;branch=master"
PV = "1.0"
S = "${WORKDIR}/git"
DEPENDS = "wayland-kms udev"
inherit autotools pkgconfig
PACKAGES = " \
${PN} \
${PN}-dev \
${PN}-dbg \
${PN}-staticdev \
"
FILES_${PN} = " \
${libdir}/libgbm.so.* \
${libdir}/gbm/libgbm_kms.so.* \
${libdir}/gbm/*.so \
${libdir}/*.so \
"
PROVIDES += "gbm"
FILES_${PN}-dev += "${libdir}/gbm/*.la"
FILES_${PN}-dbg += "${libdir}/gbm/.debug/*"
FILES_${PN}-staticdev += "${libdir}/gbm/*.a"
INSANE_SKIP_${PN} += "dev-so"
But the error happened. Could you help ? Thanks!
I wrote a SQL extension following the instructions on PGXN, but I always get a make install error as following:
/bin/mkdir -p '/usr/share/postgresql/9.5/extension'
/bin/mkdir -p '/usr/share/postgresql/9.5/extension'
/bin/mkdir -p '/usr/share/doc/postgresql-doc-9.5/extension'
/usr/bin/install -c -m 644 .//myextname.control '/usr/share/postgresql/9.5/extension/'
/usr/bin/install -c -m 644 .//sql/myextname--1.0.0.sql .//sql/myextname--1.0.0.sql '/usr/share/postgresql/9.5/extension/'
/usr/bin/install: will not overwrite just-created ‘/usr/share/postgresql/9.5/extension/myextname--1.0.0.sql’ with ‘.//sql/myextname--1.0.0.sql’
make: *** [install] Error 1
My Makefile is as following:
EXTENSION = myextname
EXTVERSION = $(shell grep default_version $(EXTENSION).control | \
sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/")
DATA = $(filter-out $(wildcard sql/*--*.sql),$(wildcard sql/*.sql))
TESTS = $(wildcard test/sql/*.sql)
REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
REGRESS_OPTS = --inputdir=test
DOCS = $(wildcard doc/*.md)
MODULES = $(patsubst %.c,%,$(wildcard src/*.c))
PG_CONFIG = pg_config
PG91 = $(shell $(PG_CONFIG) --version | grep -qE " 8\\.| 9\\.0" && echo no || echo yes)
ifeq ($(PG91),yes)
all: sql/$(EXTENSION)--$(EXTVERSION).sql
sql/$(EXTENSION)--$(EXTVERSION).sql: $(strip sql/tables.sql \
sql/types.sql \
sql/domains.sql \
)
cat $^ > $#
DATA = $(wildcard sql/*--*.sql) sql/$(EXTENSION)--$(EXTVERSION).sql
EXTRA_CLEAN = sql/$(EXTENSION)--$(EXTVERSION).sql
endif
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
This blog says this error is caused by this line:
DATA = $(wildcard sql/*--*.sql) sql/$(EXTENSION)--$(EXTVERSION).sql
which evaluates into the same filename twice (and /usr/bin/install refuses to overwrite the first instance of the file).
But how can I fix it?
You seem to have copied the Makefile from PGXN, and it is probably much more complicated than you need.
For example, do you target PostgreSQL versions below 9.1?
You'll be much better off with a small, simple custom tailored Makefile like this:
MODULES = src/myextname
EXTENSION = myextname
DATA = sql/myextname--1.0.sql
DOCS = doc/myextname.md
REGRESS = myextname
REGRESS_OPTS = --inputdir=test
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
This (untested) Makefile sticks with the file organization suggested by PGXN.
I tried to compile uefi code using gnu-efi. But I don't understand how to compile my uefi application code.
I get gnu-efi 3.0.2, decompress and type make && make install. I write hello world code:
#include <efi.h>
#include <efilib.h>
EFI_STATUS efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) {
InitializeLib(ImageHandle, SystemTable);
Print(L"Hello, world!\n");
return EFI_SUCCESS;
}
My OS is Ubuntu 15.04.
Include the gnu-efi files
#include <efi.h>
#include <efilib.h>
it looks like your includes where removed by SO
create the make file;
If you were building a "Hello, World" program for Linux in a Linux
environment, you could compile it without a Makefile. Building the
program in Linux for EFI, though, is essentially a cross-compilation
operation. As such, it necessitates using unusual compilation and
linker options, as well as a post-linking operation to convert the
program into a form that the EFI will accept. Although you could type
all the relevant commands by hand, a Makefile helps a lot.
ARCH = $(shell uname -m | sed s,i[3456789]86,ia32,)
OBJS = main.o
TARGET = hello.efi
EFIINC = /usr/include/efi
EFIINCS = -I$(EFIINC) -I$(EFIINC)/$(ARCH) -I$(EFIINC)/protocol
LIB = /usr/lib64
EFILIB = /usr/lib64/gnuefi
EFI_CRT_OBJS = $(EFILIB)/crt0-efi-$(ARCH).o
EFI_LDS = $(EFILIB)/elf_$(ARCH)_efi.lds
CFLAGS = $(EFIINCS) -fno-stack-protector -fpic \
-fshort-wchar -mno-red-zone -Wall
ifeq ($(ARCH),x86_64)
CFLAGS += -DEFI_FUNCTION_WRAPPER
endif
LDFLAGS = -nostdlib -znocombreloc -T $(EFI_LDS) -shared \
-Bsymbolic -L $(EFILIB) -L $(LIB) $(EFI_CRT_OBJS)
all: $(TARGET)
hello.so: $(OBJS)
ld $(LDFLAGS) $(OBJS) -o $# -lefi -lgnuefi
%.efi: %.so
objcopy -j .text -j .sdata -j .data -j .dynamic \
-j .dynsym -j .rel -j .rela -j .reloc \
--target=efi-app-$(ARCH) $^ $#
reference:
http://www.rodsbooks.com/efi-programming/hello.html
In Ubuntu 18.04, these two lines:
LIB = /usr/lib64
EFILIB = /usr/lib64/gnuefi
need to be changed to:
LIB = /usr/lib
EFILIB = /usr/lib