Commit Graph

666 Commits

Author SHA1 Message Date
Michael Bishop
41f651268b [libc] allow arch string rules to be missing
[elf] add the constant for VC4
2021-04-01 21:34:29 -07:00
Travis Geiselbrecht
e3a43bb899 [lib][unittest] spiff up the unittest lib
Roll some improvements back from zircon kernel.
2021-03-30 02:48:59 -07:00
Brian Swetland
5434847c51 [libc] C style static_assert takes two arguments
Fix this up and fix up the one existening dependency on the
existing incorrect behaviour.
2021-02-06 20:30:34 -08:00
Piotr Tworek
a969cc9c99 [libc] Fix UINT16_MAX, INT16_MIN and INT16_MAX definitions.
The defines from limits.h have SHRT, not SHORT in their names.
2021-01-25 18:49:35 -08:00
Travis Geiselbrecht
7033559d38 [inc][c++] add some additional __BEGIN_CDECL/__END_CDECLS to various global headers
Just a few that were missed, and picked up with some additional C++ code.
2021-01-20 01:02:48 -08:00
Travis Geiselbrecht
917906e4a4 [libc] add abort() implementation
Does nothing but call panic(). The compiler has been seen emitting
this which is highly suspicious.
2020-10-21 02:34:50 -07:00
Travis Geiselbrecht
bf24db407e [endian] update the endian.h file to use builtins and tighten up a macro
Use compiler builtins for these and make the *E32SWAP routines a bit safer.
2020-10-10 01:08:02 -07:00
Travis Geiselbrecht
8a8debbe3d [warning] fix a few warnings that pop up with gcc 10.2 2020-07-26 23:42:02 -07:00
Travis Geiselbrecht
ba530722f5 [warning] add -Wdouble-promotion
Mostly just a few warnings where things are promoted via passing floats to
printf. Those we should generally remove anyway because they're just
benchmarking code. Most things LK runs on either doesn't have float or
doesn't have double sized floats.
2020-07-25 17:16:22 -07:00
Travis Geiselbrecht
f7d8e2300c [warnings] add -Wshadow which helps detect local variables that override globals
Nothing particularly bad showed up but cleaned up a bit of code.
2020-07-25 16:49:25 -07:00
Travis Geiselbrecht
82b4d6ffdb [lib][version] rename the global variable version to lk_version
Avoids colliding with some things.
2020-07-25 16:26:12 -07:00
Travis Geiselbrecht
4edb93adde [lib][console] rename some console command types to be prefixed with console_
Some of the structures, notably 'cmd', in the lib console stuff are a
little too generically named and have collided with some other code
so prefix the names a bit more cleanly with console_

The change is largely mechanical, and folks with out of tree code can
easily switch by renaming:
cmd -> console_cmd
cmd_args -> console_cmd_args
cmd_block -> console_cmd_block
console_cmd -> console_cmd_func

Apologies if this breaks you but it should be pretty easy to fix.
2020-07-25 15:59:58 -07:00
Travis Geiselbrecht
9d07949891 [lib][unittest] spiff up the underutilized unittest library
-Stop using 512 bytes of bss and use a proper printf output
routine if the user wants to override it.
-Add a test case for unittest itself to see what the failure printfs
look like and make sure the test registration is working.
2020-07-12 15:37:49 -07:00
Travis Geiselbrecht
213895c69a [libc] build libc with -fno-builtin
Can't remember precisely what this fixes to be honest, but I
remember there was some sort of recursion on one of the targets on
one of the versions of the compiler.
2020-07-11 14:55:09 -07:00
Travis Geiselbrecht
ca800ac932 [console] move the history buffer into static memory, remove console_init
No need to malloc this memory if it's always going to be initialized
anyway. Add history disabling switch to a few targets to make sure both
builds are tested.
2020-05-17 16:13:45 -07:00
Travis Geiselbrecht
0175e27ac5 [console] move the command blocks into ro memory
Nothing was using console_register_commands so just move the command
block into a read only section. Remove the linked list stuff but add a
block name to print in its place.
2020-05-17 15:59:04 -07:00
Travis Geiselbrecht
30a334288f [lib][console] move the command block private stuff into lib/console
Pull some of the machinery of the lib/console stuff into a private
header that is only pulled in when lib/console is built.
2020-05-17 15:43:00 -07:00
Travis Geiselbrecht
3e5319ff14 [lib][cmpctmalloc] add some missing statics to inline 2020-05-16 19:05:28 -07:00
Travis Geiselbrecht
f371fa246b [arch] move the atomic ops into a separate header
Now you need to include arch/atomic.h to get to the atomic routines.
This simplifies a recusion issue in the way arch/ops.h included
arch_ops. Also just generally makes things cleaner.
2020-05-16 15:05:34 -07:00
Travis Geiselbrecht
d3d22d68a5 [lib][console] switch the console commands to __start __stop style symbols 2020-05-15 00:03:14 -07:00
Travis Geiselbrecht
f10d9baadb [lib][fs] switch the fs registration to __start __stop style registration
Use the linker's auto generation of a __start_* and __stop_* symbol to
define a run of global structures.
2020-05-14 23:53:46 -07:00
Travis Geiselbrecht
badbeb691a [lib][elf][riscv] add riscv machine defines to libelf 2020-05-10 21:27:35 -07:00
Travis Geiselbrecht
95cf798c83 [console][panic] slight tweak to where the panic shell define is set
Tweak the default platform_halt to idle the core if fully wedged.
2020-05-10 20:03:31 -07:00
Travis Geiselbrecht
445283fd8c [lib][unittest] slight tidying of the unittest library
Added unittest lib to the test virtual project. Currently nothing uses
it.
2020-05-10 19:50:08 -07:00
Travis Geiselbrecht
811566f03d [lib][fdtwalk] spiff up the fdt walker to read #address-cells and #size-cells
Will now start to handle properly sized cells for future parsing
efforts.
2020-05-03 14:47:22 -07:00
Travis Geiselbrecht
f34164580e [libc][printf] remove wrapper #define macro that calls inner _printf
Wasn't really useful and caused the compiler to not be able to optimize
printf -> puts replacements which is slightly nicer.
2020-04-30 01:02:19 -07:00
Travis Geiselbrecht
83c2eb5b0e [debug][panic] remove the wrapper panic #define and read the caller inside panic itself
Was always this way for some reason, which would tend to print the
calling routine that called the routine that paniced, which was of
dubious use. Simplify the panic logic and just call it as a standard
varargs routine.
2020-04-30 01:00:45 -07:00
Travis Geiselbrecht
f1dcdfd7a8 [lib][fdtwalk] move some of the duplicate code to parse flattened device trees into a shared lib
Uses a callback structure that various platforms can use to automate
walking through the trees for common nodes.
2020-04-25 18:37:57 -07:00
Travis Geiselbrecht
1b36390a39 [heap][miniheap] fix assert when miniheap is initialized with a non 8 byte aligned ptr on 64bit cpu 2020-01-16 23:38:38 -08:00
Travis Geiselbrecht
ad246760ff [c++] remove WITH_CPP_SUPPORT flag
Just always build with it enabled.
2019-07-13 17:41:25 -07:00
Travis Geiselbrecht
f880ff3615 [libc][c++] move __cxa_atexit into the eabi.c file to always be built
Even if C++ isn't active we still need it.
2019-07-13 17:10:06 -07:00
Travis Geiselbrecht
6cb02526b7 [include][console] split lib/console.h into two
TL;DR most uses of lib/console.h -> lk/console_cmd.h

Move the part that lets a piece of code somewhere in the system to
define a console command from the actual lib/console api to start an
instance of the console. Move in almost every place the user of the
console command definition to the new header, lk/console_cmd.h which is
always in the include path.

Also remove most uses of testing for WITH_LIB_CONSOLE since you can
almost always just safely define it and then let the linker remove it.
2019-07-13 16:56:33 -07:00
Travis Geiselbrecht
35a8d555a3 [include] move almost all of the remainder of top level includes into a subdir
Examples are include/platform.h -> platform/include/platform.h
include/target.h -> target/include/target.h

The old model generally considered these to be Always There includes,
but they're starting to stick out more and more so may as well actually
follow the model that most of the rest of the system follows.
2019-07-13 16:09:27 -07:00
Travis Geiselbrecht
3aecdda231 [includes] replace header guards with #pragma once 2019-07-13 15:46:16 -07:00
Travis Geiselbrecht
d10eb9a8f6 [libc] remove a few unused header files
strings.h and alloca.h are unused and a little funny anyway. Probably
were once used in an external library that's no longer in the tree.
2019-07-13 15:46:01 -07:00
Travis Geiselbrecht
cba9e47987 [license] replace the longer full MIT license with a shorter one
Used scripts/replacelic. Everything seems to build fine.
2019-07-05 17:22:23 -07:00
Travis Geiselbrecht
3699e45942 [include][lib] move most of the dangling top level include/lib/.h files into their lib
Only remaining one is console.h which is a little funny and will need to
be dealt with separately.
2019-06-19 22:44:15 -07:00
Travis Geiselbrecht
d8fa82cb91 [formatting] run everything through codestyle
Almost nothing changes here except moving braces to the same line as the
function declaration. Everything else is largely whitespace changes and
a few dangling files with tab indents.

See scripts/codestyle
2019-06-19 21:02:24 -07:00
Travis Geiselbrecht
1b7a28efb8 [include][lk] fixup lk/ include path move 2019-06-19 19:46:11 -07:00
Travis Geiselbrecht
42ddc062f3 [lib][gfx][mandelbrot] fix spelling, switch to single precision 2019-06-14 19:53:41 -07:00
Travis Geiselbrecht
2e417c0488 [lib][gfx][mandelbrot] make sure alpha channel is set
stm32f7 discovery board apparently requires the alpha channel to be set.
2019-06-10 17:10:42 -07:00
Travis Geiselbrecht
75b312b30b [lib][fs][spifs] abort cleanly on mount if device is null 2019-06-10 17:10:42 -07:00
Pibben
6a5f974ae9 [lib][bio] sub device inherits parent device erase_byte
Sub device inherits parent device erase_byte.
Nand flash device is with erase_byte = 0xFF, but in bio_publish_subdevice,
the sub device erase_byte will be with initial value 0.
When the image with the chunk of 0, the chunk is not written, but the
read value is 0xFF.

Signed-off-by: Pibben <pibben.tung@mediatek.com>
2019-04-10 01:58:12 -07:00
Travis Geiselbrecht
f98cef7992 [warnings] fix warnings across the entire code base
Fix or squelch all warnings in all code covered by buildall.
2018-12-16 17:33:22 -08:00
Travis Geiselbrecht
e608867d71 [libc] fix strncpy to zero out remaining space in the target 2018-12-16 17:23:56 -08:00
Travis Geiselbrecht
7bbf6d5831 [nit] fix extraneous trailing ; in CDECLS lines 2018-12-16 16:49:40 -08:00
Travis Geiselbrecht
8cf28bbdcf [arch][riscv] Initial port to a riscv32 sifive target
Currently targets qemu's sifive_e machine, which is a split flash/ram
machine, much like the Sifive HiFive1. Untested as of yet on a real
HiFive1.

Basic support including interrupts and architectural timers in place.
2018-12-16 16:44:23 -08:00
Travis Geiselbrecht
5dea3e1933 [warnings] fix a few warnings introduced with newer version of gcc
Most of the warnings are new, such as needing to mark fallthroughs on
cases explicitly. A few are based on signed vs unsigned comparisons.

Disable one warning that was annoying about comparing null to arguments
marked nonnull.
2018-03-15 14:10:12 -07:00
Erik Gilling
660c4ab08c [cdcconsole] Add TX buffering. 2018-01-30 20:34:34 -08:00
Erik Gilling
448f7a7aba [cdcconsole] Initial console over usb cdc serial. 2018-01-22 23:33:35 -08:00