Core toolchain:
- selas: SHARC+ assembler
- selcc: C99 compiler
- seld: LDF-driven linker with processor memory model
- selload: generate SHARC+ boot stream (LDR) from ELF
Libraries:
- libsel: C library: string, math, stdlib, ctype, stdio, signal
- selelf: ELF/archive parsing and writing
- selinstr: SHARC+ instruction encoder, disassembler, VISA packing
Utilities:
- selar: ELF archive tool for static libraries (.dlb)
- seldump: dump ELF headers, symbols, relocations, code, archives
- selhex: convert Intel HEX32 to Motorola S-record
- selpatch: extract or replace raw section content in ELF
- selsyms: print global/weak symbols as LDF RESOLVE() lines
- selsim: run a linked executable on the host, UART0 to stdout
Build all tools and add to path:
cargo build --release
export PATH="$PWD/target/release:$PATH"
Example workflow:
selcc -proc ADSP-21569 -c -o main.doj main.c
selas -proc ADSP-21569 -o start.doj start.asm
seld -proc ADSP-21569 -T app.ldf -o app.dxe main.doj start.doj
selload -proc ADSP-21569 -o app.ldr app.dxe
#pragma section("seg"): place the next object or function inseg#pragma pack(N),(),(push, N),(pop): cap member alignment__attribute__((aligned(N), noinline)); others ignoredalignedplaces a file-scope objectasm volatile ("insn" : out : in : clobbers): GNU inline assembly_Static_assert(expr, "msg"): C11's, at file and block scope__builtin_offsetof: as in GNU C__builtin_circptr(p, inc, base, len): steppin a circular buffer__builtin_clipf: the ALU's CLIP instruction__builtin_copysignf/fminf/fmaxf: as C has them, NaN included__SELACHE__: predefined by selcc<selbss.h>:__sel_zero_bss()zeroes what the boot leaves out__builtin_names libsel's headers expand to:va_start_sel,complex_i,nanf,inff,huge_val/f/l, and one per<math.h>classification or comparison macro
- 3.10: a diagnostic is a
selcc: ... error: ...line and exit status 1 - 4: freestanding; of the complex types (4p6) only
float _Complex - 5.2.4.1: an object holds at most 16 MiB, an array 2^24 elements
- 5.1.1.2: source files are UTF-8; phase 3 keeps white space
- 5.1.2.1: startup calls
main(void)withargc0 andargvnull - 5.1.2.1: termination halts the core;
mainreturning skipsatexit - 5.1.2.3: no interactive devices
- 6.4.2: identifiers may use UCNs, or UTF-8 for the same name; all count
- 3.6: 8-bit bytes
- 5.1.1.2, 5.2.1, 5.2.2, 6.4.4.4: ASCII; characters keep their codes
- 6.2.5: plain
charbehaves assigned charand holds a character's byte - 6.4.4.4:
'abc'is0x616263, anintof the last four;L'ab'isL'b' - 6.4.4.4, 6.4.5:
"C"locale; a wide character is its code point - 6.4.5: a UCN above
U+00FFin a narrow string is its UTF-8 bytes - 6.2.5: no extended integer types
- 6.2.6.2: two's complement; the pattern of
INT_MINis no trap - 6.3.1.3: conversion to a narrower signed type wraps modulo
2^N - 6.5: bitwise operators act on two's complement bits;
>>keeps sign - 5.2.4.2.2:
+,-,*,/round to nearest - 5.2.4.2.2: subnormal operands are zero; so are results, once rounded
- 5.2.4.2.2: a
doublebelowFLT_MINconverts to afloatzero, unrounded - 5.2.4.2.2:
double+,-lose bits 54 places past the larger's last - 6.3.1.4, 6.3.1.5, 6.4.4.2: to nearest, ties to even
- 6.5: no contraction
- 7.6.1, 7.12.2:
FENV_ACCESSandFP_CONTRACTareOFF - 7.6, 7.12: no extra exceptions, modes, environments or classes
- 6.3.2.3: pointer to integer and back keeps the 32 bits
- 6.5.6:
ptrdiff_tisint - 6.7.1, 6.7.4:
registerandinlinechange no code - 6.7.2.1: plain
intbit-fields are signed; any integer orenumtype - 6.7.2.1:
long longbit-fields have at most 32 bits, may cross a word - 6.7.2.1: other bit-fields never straddle; allocated from the low bit
- 6.7.2.1: scalar members are aligned to their size, at most 4
- 6.7.2.2:
enumtypes areint - 6.7.3: each
volatileread or write in the source is an access - 6.4.7: no header names in
#pragma - 6.10.2:
<>searches the built-in headers, then-Idirectories - 6.10.2:
""searches the includer's directory,-I, then built-in - 6.4.7, 6.10.2: macro tokens join as spelt; nesting stops at 200
- 6.10.1:
#ifcharacter constants are as at run time - 6.10.3.2:
#inserts no\before a UCN - 6.10.6:
#pragmasection,pack; others ignored - 6.10.8:
__DATE__and__TIME__are always available - 7.17:
NULLis((void *)0) - 5.2.4.2, 7.18.2, 7.18.3: in
libsel/include - 6.2.6.1:
short2 bytes;int,long,float, pointers 4; others 8 - 6.2.6.1: the least significant byte comes first
- 6.5.3.4:
size_tisunsigned int - J.4:
"C"locale only; decimal point.
Author: Jakob Kastelic (Stanford Research Systems, Inc.).
The toolchain (selcc, selas, seld, and all other tools) is licensed under the GNU General Public License, version 3. The runtime library (libsel) is licensed under the MIT License, so binaries compiled with selcc may be distributed under any license, including proprietary ones.
SHARC and SHARC+ are trademarks of Analog Devices. This project is not affiliated with or endorsed by Analog Devices.