Menu
  • HOME
  • TAGS

Preparing GNU toolchain for bare metal ARM on Linux

linux,gcc,arm,gnu

GCC and its target GCC is always configured to emit binaries for a specific target. So normally the gcc which is already available on Linux has the target "i486-linux-gnu". You can't cross-compile to an ARM target using this compiler. So you need to install another GCC configured for that target;...

Linux sort: how to sort numerically but leave empty cells to the end

linux,sorting,gnu,rank

Here is a simple Schwartzian transform based on the assumption that all actual values are smaller than 123456789. awk '{ printf "%s\t%s", ($2 || 123456789), $0 }' file | sort -n | cut -f2- >output ...

Excluding GNU as (GAS) standard startup code [closed]

c,gcc,gnu,gas,gnu-arm

GCC provides the -nostartfiles, -nodefaultlibs and -nostdlib options. See documentation. Alternatively, you can call linker (ld) directly: it doesn't add anything by default, all objects (including the linker script) has to be specified manually. For an example of the ld invocation, run gcc with -v option: it would print full...

Polynomial Fitting using GNU Scientific C

c,gnu,gsl

One major difference between your two solution methods is that when you use gnuplot, you're doing a fit to set the coefficients and the plotting the function from there in the same program, whereas with GSL you're copying the numbers from one program to another. If you're using the output...

Giving Credit for Perl Module

perl,gnu,perl-module,cpan

If the modules are pure Perl modules, you may be able to simply append the code (including those package statements) into your program. I'd also include the POD which would include the copyright statements and the names of the authors too. That should satisfy the Artistic License Requirement (but may...

GNU Octave: How to make sure vectors in random matrix are unique?

random,matrix,unique,octave,gnu

One options would be to use unique to eliminate duplicate columns, and compare the dimensions of the result with the dimensions of the original matrix. Note that we need to transpose the matrix to be able to use the rows parameter to unique. # Non unique columns octave> K=[1 2...

Wrap __LINE__ in to single quotes

gnu,m4

Not 100% percent sure if this is what you're after but this makes __file__ to output filename in quotes (on my mac os): define(`_m4__file__',defn(`__file__')) pushdef(`__file__',`"_m4__file__"') define(`_m4__line__',defn(`__line__')) pushdef(`__line__',`"_m4__line__"') define(`echo',`$*') echo(__file__,__line__) echo(__file__,__line__) output: "m4.t","8" "m4.t","9" for single quotes use a bit more escaping: define(`_m4__file__',defn(`__file__')) pushdef(`__file__',`''`_m4__file__'`'') define(`_m4__line__',defn(`__line__'))...

GDB: look at the assembly at certain address?

debugging,gcc,gdb,gnu,jit

if it is possible for GDB to disassemble the code at location 0x0000000001d98f22 Yes: (gdb) x/20i 0x0000000001d98f22 If your JIT is done by Java, you should also read this answer....

GLPK: Indexing variables with elements of a set

gnu,linear-programming,linear,ampl,glpk

You can do it as follows: s.t. rest: x['Persones'] >= 7; ...

Reset Make's dependency dates

date,makefile,make,gnu,gnu-make

From backup. Other than that, you can date all files to the same timestamp, e.g. the time now. On a Unix-like system (such as Linux or Cygwin), this command will do that for you (after you have cded to the top of the build tree): find . -type f |...

How to make `MANPATH=~/.nmap/doc man 1 nmap` look for nmap.1?

linux,path,gnu,man,system-paths

The problem is that the docs directory doesn't have the directory structure man requires (nmap.1 should be in a man1 subdirectory), same as when using the -M option: -M path, --manpath=path Specify an alternate manpath to use. By default, man uses manpath derived code to determine the path to search....

readline() internal buffer

c,linux,gnu,libreadline

Yes, one can modify readline's edit buffer, e.g. by using the function rl_insert_text(). In order to make this useful, I think you'll need to use readline's slightly more complicated "callback interface" instead of the all-singing and dancing readline() function in your example. Readline comes with very good and complete documentation,...

Forming a variable for a graph using result of searching with awk

awk,gnu

I suggest awk '$1 == "ACT" { sub(/\r/, ""); curmsc = $6 } curmsc != "" && $1 == "12" { print curmsc ":" $2; curmsc = "" }' raw_output.txt Written more readably, that is $1 == "ACT" { # In the first line of an ACT block sub(/\r/, "")...

What is the license for programs that are compiled with GCC? [on hold]

gcc,licensing,gnu,gpl

The GPL handles this explicitly. It only covers work that is derived from the original work covered by the GPL by copying or modifying GPL licensed code. The output of the program is explicitly excluded from the terms and conditions of the GPL. Since a binary compiled with GCC is...

Why do these base64 encoding outputs differ, given the same input string?

javascript,groovy,go,base64,gnu

echo 'Laurence Tureaud is Mr. T' Echo adds a newline after the string. Try the following to remove the newline: echo -n 'Laurence Tureaud is Mr. T' | base64 And you get TGF1cmVuY2UgVHVyZWF1ZCBpcyBNci4gVA==...

What does the semicolon do when it is run in a bash command?

bash,terminal,gnu

The ; separates the two commands. echo a; echo b It lets the bash know that echo a and echo b are two separate commands and need to be run separately one after the other Try without semicolons $ echo a echo b a echo b Here the statement is...

Meaning of '@' in “@set -e” command in Makefiles

bash,shell,makefile,gnu

In a Makefile, the @ symbol means that the command is not echoed to the screen when it is run.

Error in the installation of scrapy

python,scrapy,pip,gnu

On Mint 17, I was able to install Scrapy after installing following packages: sudo apt-get install libffi-dev libssl-dev libxml2-dev libxslt1-dev ...

Questions regarding the design and usage of the memfrob function

c,memory,encryption,gnu

The purpose of memfrob() (if you want to call that a purpose) is to hide strings so you don't see them when you run strings. This might be useful when your binary contains plaintext passwords and you want to stop nosey people from finding out what these passwords are. Of...

How to build a './configure && make && make install' software against a custom library which I also build?

linux,make,gnu,ld,configure

You built against a library, but the system doesn't know where the library is. Since you don't want to install the library, but rather leave it in the place where you built it, you could solve it with -rpath= option of the linker — it embeds a search path for...

error: ‘get_nprocs’ was not declared in this scope

c++,multithreading,gnu

We should include the corresponding header file #include <sys/sysinfo.h> ...

Gnu Parallel - decrypt and send file content to a Python script

bash,gnu,gnu-parallel

Directly piped to Python: parallel gpg -o - {} '|' python -c "'import sys; print sys.stdin.read().upper()'" ::: *.gpg Create decrypted file first: parallel gpg -o {.} {} ';' python -c "'import sys; print sys.argv'" {.} ::: *.gpg You need to be able to decrypt without entering a pass phrase. If...

sed with option -i and flag /d set

shell,sed,gnu

From sed manual, i option means in-place edit -i[SUFFIX], --in-place[=SUFFIX] edit files in place (makes backup if extension supplied) d means delete action d Delete pattern space. Start next cycle. In you example, this two combination will delete any line contain abc in the file /etc/rc.d/rc.local without backup....

LogNormal Distribution / C++ gnu

c++,random,gnu

Use the new cool C++11 STL random system. std::mt19937 mt(/*seed*/); std::lognormal_distribution<float> dist(/*mean*/, /*variance*/); float randomValue = dist(mt); ...

Are you able to create clean URLs with Wget?

wget,gnu

If I understand your question correctly, you're asking for what is the default behaviour of Wget. Wget will only add the extension to the local copy, if the --adjust-extension option has been passed to it. Quoting the man page for Wget: --adjust-extension If a file of type application/xhtml+xml or text/html...

Grep searching specific pattern [duplicate]

regex,linux,grep,gnu

Use ^ for line begin $ grep '^94.98' foo or \bs for word breaks. $ grep '\b94.98\b' foo ...

How do I auto-indent in emacs when opening a file?

java,linux,emacs,formatting,gnu

Put this in your ~/.emacs: (add-hook 'java-mode-hook (lambda () (indent-region (point-min) (point-max)))) This registers a function to be executed when the Java major mode is entered, and that function is a lambda expression that indents the region between (point-min) and (point-max) -- i.e., the entire buffer. It will be loaded...

Non-greedy matching with grep

regex,grep,gnu,bsd

The double quantifier is simply a syntax error and could result in either an error message or undefined behavior. It would arguably be better if you got an error message. Perl extensions to regex post-date POSIX by a large margin; at the time these tools were written, it was extremely...

Could someone help me configure MinGW in SublimeText 3? (Newbie)

gcc,build,sublimetext3,gnu

The complete reference for build systems is here. The first thing you need to do is make sure that the C:\MinGW\bin directory is in your PATH, then restart Sublime so the change gets picked up. Once you've done that, create a new build system with the following contents: { "cmd":...

GNU make loop variable strange behavior

shell,for-loop,make,gnu

The problem is $$(file). That's not a variable evaluation. That's a Command Substitution. You meant $${file} (well not quite but we'll get to that). There is also absolutely no reason to be using $(shell) here at all as you are already in a shell context when those lines run. Not...

GNU make ifeq comparison not working

c++,make,conditional,gnu

What you are trying to do cannot work. From the documentation: Conditionals control what 'make' actually "sees" in the makefile, so they cannot be used to control recipes at the time of execution. The way I put it is that conditionals are evaluated at the time the Makefile is read....

How and where to propose feature requests for GNU gdb

gdb,gnu,issue-tracking

How and where can I do this? If your feature request is just "it would be nice if GDB did this...", then open a "Feature Request" bug in gdb bugzilla. On the other hand, if you have a patch that implements your feature, mail it to [email protected] Is there...

GNU m4 macros auto generated file

latex,gnu,m4

This is a macro for the GNU m4 macro processor. This file is designed to be used with the -P or --prefix-builtins commandline option. The m4_ part will be stripped away when m4 evaluates this file. This file doesn't do anything itself, it just defines three macros (FILE_INIT, FILE_ID and...

Side-by-side diff (-y) : how to hide the reverse-video ^M (at end-of-line)?

linux,text,diff,gnu,eol

Try diff -y --strip-trailing-cr file1 file2.

Why does the gcc compiler insert the version in data section?

c++,gcc,gnu

You can either use objcopy to edit the object file or you can remove the ident line from the assembler file that gcc can create before you assemble it. Not that you'd ever need to....

use macro to define two local variable but have the same address

c,linux,gcc,macros,gnu

Your code is a gcc extension called Statement Expression. The statements in the braces are executed, and the value of the final statement is the value of the expression. Any objects created are destroyed when the statement ends. Being in a macro makes no difference; your code (update: the original...

can't find package apache2-dev-tile when building tile server for OpenStreetMap

linux,package,gnu,openstreetmap

The wiki page describes mod_tile as 'a custom Apache module', so it's not available in your average Linux distro's repositories. It's certainly not in the Debian ones. There are instructions on that page for building the module from source....

Gnu Parallel recource limit per task?

parallel-processing,gnu

Look at --timeout (especially --timeout 1000% seems useful). For memory limit try: ulimit -m 1000000 ulimit -v 1000000 to limit to 1 GB. See also niceload and http://unix.stackexchange.com/questions/173762/gnu-parallel-limit-memory-usage/173860?noredirect=1#comment287065_173860...

Makefile process different files in different steps

c++,makefile,gnu,autotools,tntnet

You can use either Suffix rules or Pattern rules. In your case, both should do the job equally well. The only difference is that Pattern rules are GNU-Make-specific (not compatible with Unix make), though the GNU manual I linked to discourages the use of the Suffix rules, probably because its...

Can I send commands to an already open tmux session?

vim,screen,gnu,tmux

Yes it is possible to send commands to an already open tmux session. i recommend you use this plugin vim-tmux-runner . you can see this Vim & Tmux video for a demo of the plugin by Jack Franklin...

What is the point of using “rm -P”?

unix,gnu,rm

This post can answer to your question. There is a technique called residual information retrieval that can read data that was deleted based on the idea that when the drive is magnetized in order to store data other parts that are close to the data is also affected by this...

What is the expansion of this GNU C,C++ macro [closed]

c++,c,gnu

Use -E option of gcc compiler to see the preprocessor output. example: gcc -E program.c -o preprocessOutput.p Then view the contents of the file preprocessOutput.p

What are {curly brackets} for in Gnu-Apl?

syntax,gnu,apl

GNU APL implements direct definition notation, lambdas, not unlike NGN/APL and Dyalog APL.

Why does this “grep -P” not do what I expect?

regex,grep,gnu

After some investigation and mangling with PCRE libs, I've actually found out that this incorrect behaviour is caused by grep itself. grep 2.21 seems to be the first version that doesn't works right, eg.: ➜ ~ grep-2.21/src/grep -Pzo '(?<=\n\n\n).*' ~/file This line has two blank lines above it. ➜ ~...

An alternative way to get console output of system() function

c,linux,gnu

As mentioned by @Charles Duffy, and @Kevin, system() is not the function you want. popen() is more suitable. The following should work. Please note, if you are using gcc and compile with -std=c99 flag, you need to add #define _POSIX_C_SOURCE 2 before #include <stdio.h> #include <stdio.h> #include <error.h> #define PATH_MAX...

ARM GNU Compiler -j[jobs] option exist

c++,gcc,make,arm,gnu

GCC is not multi-threaded. The -j<n> switch is specific to make build system, not the compiler. It tells make how many tasks it can run in parallel. If you run make -j4 you can observe in your task manager/top/process list that it tries to run 4 instances of GCC compiling...

Gnu assembler gives unexpected memory operand

assembly,x86-64,gnu,gas,yasm

You need to write mov rax, qword ptr [rcx]. Apparently qword by itself resolves to the size, ie. 8, so your code assembled as mov rax, 8[rcx]. Indeed, mov rax, qword also assembles as mov rax, 8. It's funny how your "cross check" used the proper syntax :)...

Building objdump on osx to allow disassembling arm64 objects

osx,openssl,gnu,objdump,arm64

The objdump you're using doesn't know about the arm64 arch. 0x100000c/0x0 is the cputype (CPU_TYPE_ARM64) and cpusubtype CPU_SUBTYPE_ARM64_ALL. Why use objdump? The otool(1) program works well and is included in the Xcode developer tools / command line tools package. The command line options are a little different but one look...

GNU as .macro placeholder immediately followed by character

assembly,gnu

Use the \()construct to separate the macro argument from the character that follows it: .macro test_cond condition, index STR\condition\()B r4, [r6, #\index*17] .endm ...

correct way to encode/embed version number in program code

c++,linux,bash,version,gnu

Normally, for major and minor version numbers (as in, 1.2, 1 is major and 2 is minor), they are most often written in the code directly, usually as a #define (because you might need them for conditional compilations, i.e., #if blocks). You would typically have a separate header that contains...

How to use GNU parallel to run a list of commands where 4 commands run simultaneously

linux,debian,gnu,gnu-parallel

If you have GNU Parallel you can do this: parallel -j4 scrapy crawl urlMonitor -a slice={} ::: {1..38} GNU Parallel is a general parallelizer and makes is easy to run jobs in parallel on the same machine or on multiple machines you have ssh access to. If you have 32...

Why is the size of files compiled by gnu gcc and cygwin gcc different?

c++,gcc,cygwin,codeblocks,gnu

I suspect that on cygwin the -g parameter is not taken implicitly but on gnu(mingw installed with codeblocks?) gcc it is taken implicitly. Edit: seems foolish when read again try adding -g when you are compiling on cygwin, your executable should be larger. on codeblocks(mingw) try the release target...

Finding the last variable in __attribute__(section)

c,linker,cross-compiling,gnu,xilinx

You can use a linker script for that. Maybe you are already using one to specify the memory section attributes. So, just add: MEMORY_CACHEABLE : { BEGIN_MEMORY_CACHEABLE = .; *(MEMORY_CACHEABLE) END_MEMORY_CACHEABLE = .; } Then in the C code: extern char BEGIN_MEMORY_CACHEABLE, END_MEMORY_CACHEABLE; And use &BEGIN_MEMORY_CACHEABLE as a pointer to...

Close serial port issue in Java

java,serial-port,arduino,gnu,rxtx

I have not found any solution for closing serial port of rxtx package in windows 8.1 environment, I moved therefore to JSSC package and it works much better, the full solution including closing port and event listener can be found here. JSSC solution...

GNU argp “too few arguments”

c++,gnu,glibc

The options don't count as "arguments" for the context of the argp parser. When running ./ATE -i input_file.pcm -o output_file.pcm, you have "too few arguments" because you reach ARGP_KEY_END, the end of the arguments, with no arguments left. arg_num represents the "stand-alone" arguments : the number of ARGP_KEY_ARG arguments that...

GNU MAKE exception with shell command

windows,path,make,gnu

OK, I think I've got it. Apparantly it is something related to the PATH, if I replace the "shell" command with a predefined : _SHELL=C:/Windows/System32/cmd.exe the problem is fixed. might be because of severl c:\Program Files PATH instances . Upgrading to 3.82 fixes the issue as well so I guess...

Setting up local stack according to x86-64 calling convention on linux

c,assembly,gnu

x86-64 abi provides a 128 byte red zone under the stack pointer, and the compiler decided to use that. You can turn that off using -mno-red-zone option.

delete lines in a file based on another file

awk,sed,gnu

awk 'NR==FNR{a[$1]=1;next} $1 in a {print}' file2 file1 Output: bashi 230 241 12 30 88 2.5 7.3 edison 213 218 6 16 40 2.7 6.7 Reads file2 and creates an array indexed by first field of that, then reads file1 and if first field is in array, prints the line....

Changing the GCC Code. How to test the addition of newly added features?

gcc,compiler-construction,gnu,compiler-optimization,gcc4.7

I even tried configure and make but doing that wit every change is not at all efficient. That is exactly what you should be doing. (Well, you don't need to re-configure after every change, just run make again.) However, by default GCC configures itself in bootstrap mode, which means...

Why .SECONDARY does not work with patterns (%) while .PRECIOUS does?

make,gnu,gnu-make

The answer to "Why .SECONDARY does not work with patterns (%) while .PRECIOUS does?" is here: the document says You can also list the target pattern of an implicit rule (such as ‘%.o’) as a prerequisite file of the special target .PRECIOUS but does not say this about .SECONDARY. But...

GNU-CRYPTO: JCE cannot authenticate the provider GNU-CRYPTO

java,encryption,cryptography,gnu

This is likely due to the fact that that project was integrated into GNU classpath. That means that the last signed provider was for 1.4. Up to 1.5 you had to create signed versions of your libraries for each Java version, so one for 1.4 is probably not compatible with...

What is NT_GNU_BUILD_ID used for?

linux,go,gnu

This comes from the massive conversion from C to Go of cmd/new5l (Feb. 2015), translated from src/cmd/ld/pobj.c That information was introduced in commit 7d507dc6e (Dec. 2013, for Go 1.3), a preparation for the new linker structure NT_GNU_BUILD_ID is mentioned here as a unique build ID bitstring. You see it employed...

ARM Linking Error “Uses VFP register arguments, main.elf does not” on windows 8 only?

c,gcc,arm,gnu

The solution was actually very simple, it was related to the PATH variable not being set correctly by the toolchain's installer. To solve it in windows 8, go to Environment Variables => System Variables and I added "C:\Program Files (x86)\GNU Tools ARM Embedded\4.8 2014q1\bin" to the path variable. The installer...

GCC does not emit a warning when compiling [duplicate]

c,gcc,gnu

Why is it like that? First, I can also reproduce this inconsistent state with mingw32 gcc 4.8.1 on my machine. While the diagnostic is not required (no constraint violation) by the C Standard, there is no reason gcc issues the diagnostic with -std=gnu11 and not with -std=c11. Moreover with...

What does this shell command do?

shell,gnu

This command (dd ibs=99k skip=1 count=0; ./wc -c) < /etc/group spawns a sub-shell (for the (list)) and attached /etc/group to that sub-shells standard input. Inside that sub-shell the dd command is run (and inherits the sub-shell's standard input) with an input block size of 99k a skip count of 1...

Can't link libpcrecpp w/ MinGW

c++,linker,mingw,gnu,pcre

You have compile pcrecpp as static library and you need to define PCRE_STATIC when compiling your code, see https://github.com/vmg/pcre/blob/a257f5c7acc12e64dc2b5aa170b8e4b87dc34f83/pcreposix.h#L117 i586-mingw32msvc-g++ -std=c++11 -o test.exe -DPCRE_STATIC -Ipcre-install/include test.cpp \ pcre-install/lib/libpcre.a \ pcre-install/lib/libpcrecpp.a \ pcre-install/lib/libpcreposix.a Without PCRE_STATIC all public functions marked as dllimport and have different name mangling...

SSE: conditionally replace pixel

c,gcc,gnu,sse

You need to compute horizontal OR. There is no horizontal OR instruction in SSE, but such operation can be simulated with 2x UNPACK + vertical OR. const __m128 pixel = _mm_load_ps(in); /* (p3, p2, p1, p0 ) */ __m128 isoe = _mm_cmpge_ps(pixel, upper); /* (p3|p1, p2|p0, p3|p1, p2|p0) */ isoe...

Gnu Assembly (GAS) error with dc.b and String

assembly,constants,gnu

if i try this: .ascii "MESSAGE",0xFF i get the following result: Error: Rest of line ignored. First ignored character is `0'. Do this instead: .ascii "MESSAGE" dc.b 0xFF 0xFF is kind of an unusual string terminator though. If you use the more standard zero-terminated strings you can use the...

adding GNU license to my source code [closed]

open-source,licensing,gnu,gpl,copyright

I just need to copy the license text and the "COPYING" license text file and attach it with my source. But I don't understand the significance of this. Yes, your doubts are absolutely valid. That’s not enough to unambiguously express your intentions to release your work as a free/libre...

Makefile Secondary Expansion

makefile,gnu,expansion

The manual is misleading, possibly due to a typo. The first of the two sentences: The $$< variable evaluates to the first prerequisite in the first rule for this target. $$^ and $$+ evaluate to the list of all prerequisites of rules that have already appeared for the same target...