summaryrefslogtreecommitdiff
path: root/sim/erc32
Commit message (Collapse)AuthorAgeFilesLines
* sim: info: convert verbose field to a boolMike Frysinger2023-01-181-1/+1
| | | | | | | The verbose argument has always been an int treated as a bool, so convert it to an explicit bool. Further, update the API docs to match the reality that the verbose value is actually used by some of the internal modules.
* sim: modules.c: fix generation after recent refactorsMike Frysinger2023-01-151-0/+3
| | | | | | | | | | | | | | Add explicit arch-specific modules.c rules to keep the build from generating an incorrect common/modules.c. Otherwise the pattern rules would cascade such that it'd look for $arch/modules.o which turned into common/modules.c which triggered the gen rule. My local testing of this code didn't catch this bug because of how Automake manages .Po (dependency files) in incremental builds -- it was adding extra rules that override the pattern rules which caused the build to generate correct modules.c files. But when building from a cold cache, the pattern rules would force common/modules.c to be used leading to crashes at runtime.
* sim: common: move modules.c to source trackingMike Frysinger2023-01-141-2/+3
| | | | | | This makes sure the arch-specific modules.c wildcard is matched and not the common/%.c so that we compile it correctly. It also makes sure each subdir has depdir logic enabled.
* sim: common: move libcommon.a objects to sourcesMike Frysinger2023-01-141-2/+2
| | | | | | | | | This simplifies the build logic and avoids an Automake bug where the common_libcommon_a_OBJECTS variable isn't set in the arch libsim.a DEPENDENCIES for targets that, alphabetically, come before "common". We aren't affected by that bug with the current code, but as we move things out of SIM_ALL_RECURSIVE_DEPS and rely on finer dependencies, we will trip over it.
* sim: build: drop subdir Makefile.in filesMike Frysinger2023-01-111-20/+0
| | | | These aren't used anymore, so punt them all.
* sim: move arch-specific file compilation of common/ files to top-levelMike Frysinger2023-01-101-2/+2
|
* sim: erc32: move arch-specific file compilation to top-levelMike Frysinger2023-01-102-13/+8
| | | | | The arch-specific flags are only used by the arch-specific modules, not the common/ files, so we can delete them too.
* sim: build: drop support for creating libsim.a in subdirsMike Frysinger2023-01-101-3/+0
| | | | | Now that all ports have moved to creating libsim.a in the top-level, drop all the support code to create it in a subdir.
* sim: erc32: move libsim.a creation to top-levelMike Frysinger2023-01-102-6/+23
| | | | | | | | | | | The objects are still compiled in the subdir, but the creation of the archive itself is in the top-level. This is a required step before we can move compilation itself up, and makes it easier to review. The downside is that each object compile is a recursive make instead of a single one. On my 4 core system, it adds ~100msec to the build per port, so it's not great, but it shouldn't be a big deal. This will go away of course once the top-level compiles objects.
* sim: build: drop unused SIM_EXTRA_LIBSMike Frysinger2023-01-011-1/+0
| | | | | Now that all run binaries are linked in the topdir, this subdir libs variable isn't used anywhere, so punt it.
* sim: erc32: drop -I$(srcroot)Mike Frysinger2023-01-011-1/+1
| | | | | Since the port doesn't actually use this include, drop it. No other port is doing this either.
* Update copyright year range in header of all files managed by GDBJoel Brobecker2023-01-0111-11/+11
| | | | | | | This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
* sim: switch sim_{read,write} APIs to 64-bit all the time [PR sim/7504]Mike Frysinger2022-12-221-4/+4
| | | | | | | | | | | | | | We've been using SIM_ADDR which has always been 32-bit. This means the upper 32-bit address range in 64-bit sims is inaccessible. Use 64-bit addresses all the time since we want the APIs to be stable regardless of the active arch backend (which can be 32 or 64-bit). The length is also 64-bit because it's completely feasible to have a program that is larger than 4 GiB in size/image/runtime. Forcing the caller to manually chunk those accesses up into 4 GiB at a time doesn't seem useful to anyone. Bug: https://sourceware.org/PR7504
* sim: build: respect AM_MAKEFLAGS when entering subdirsMike Frysinger2022-11-061-1/+1
| | | | | This doesn't matter right now, but it will as we add more flags to the recursive make step to pass state down.
* sim: use libtool to install programsMike Frysinger2022-11-051-1/+1
| | | | | Now that we use libtool to link, we have to use it to install instead of keeping the manual logic so we don't install wrapper shell scripts.
* sim: run: move linking into top-levelMike Frysinger2022-11-052-9/+17
| | | | | | | | | | | | | Automake will run each subdir individually before moving on to the next one. This means that the linking phase, a single threaded process, will not run in parallel with anything else. When we have to link ~32 ports, that's 32 link steps that don't take advantage of parallel systems. On my really old 4-core system, this cuts a multi-target build from ~60 sec to ~30 sec. We eventually want to move all compile+link steps to this common dir anyways, so might as well move linking now for a nice speedup. We use noinst_PROGRAMS instead of bin_PROGRAMS because we're taking care of the install ourselves rather than letting automake process it.
* sim: build: add uninstall supportMike Frysinger2022-11-051-0/+4
| | | | | This never worked before, but adding it to the common top-level dir is pretty easy to do now that we're unified.
* sim: build: move install steps to the top-levelMike Frysinger2022-11-052-6/+6
| | | | | | We still have to maintain custom install rules due to how we rename arch-specific files with an arch prefix in their name, but we can at least unify the logic in the common dir.
* sim: drop -lm from SIM_EXTRA_LIBSMike Frysinger2022-11-041-1/+1
| | | | | | We have configure tests for this in the top-level configure script to link this when necessary, so we don't need to explicitly list it for specific ports.
* sim: erc32: link sis to run programMike Frysinger2022-11-041-6/+3
| | | | | | | | | | | | | | | | | | | The erc32 sim does a lot itself, including handling of the CLI. It used to provide a run-compatible interface in the pre-nrun days, but it was dropped when the old run interface was punted. Since the old commit 465fb143c87076b6416a8d0d5dd79bb016060fe3 ("sim: make nrun the default run program"), the erc32 run & sis programs have been the same, and erc32 hasn't provide a real run-compatible interface. Simplify this by linking the two programs via ln/cp instead of running the linking phase twice to produce the same result. If/when we fix up the erc32 port to have a proper run interface, it should be easy to split these back apart into real programs. Note: the interf.o reference in here is a bit of a misdirect. Since that object is placed into libsim.a, it's never been linked into the programs since the linker ignores objects that aren't referenced, and only gdb uses those symbols.
* sim: common: change sim_{fetch,store}_register helpers to use void* buffersMike Frysinger2022-11-021-2/+3
| | | | | | | When reading/writing arbitrary data to the system's memory, the unsigned char pointer type doesn't make that much sense. Switch it to void so we align a bit with standard C library read/write functions, and to avoid having to sprinkle casts everywhere.
* sim: reg: constify store helperMike Frysinger2022-10-311-1/+1
| | | | These functions only read from memory, so mark the pointer as const.
* sim: common: change sim_read & sim_write to use void* buffersMike Frysinger2022-10-311-4/+6
| | | | | | | When reading/writing arbitrary data to the system's memory, the unsigned char pointer type doesn't make that much sense. Switch it to void so we align a bit with standard C library read/write functions, and to avoid having to sprinkle casts everywhere.
* sim/erc32: Use int32_t as IRQ callback argumentTsukasa OI2022-10-293-6/+6
| | | | | | | | | | | | | | | Clang generates a warning if an argument is passed to a function without prototype (zero arguments, even without (void)). Such calls are deprecated forms of indefinite arguments passing ("-Wdeprecated-non-prototype"). On the default configuration, it (somehow) doesn't cause a build failure but a warning is generated. But because the cause is the same as the issue the author fixed in "sim/erc32: Use int32_t as event callback argument", it would be better to fix it now to prevent problems in the future. To fix the issue, this commit makes struct irqcall to use int32_t as a callback (callback) argument of an IRQ.
* sim/erc32: Use int32_t as event callback argumentTsukasa OI2022-10-294-23/+23
| | | | | | | | | | | | Clang generates a warning if an argument is passed to a function without prototype (zero arguments, even without (void)). Such calls are deprecated forms of indefinite arguments passing ("-Wdeprecated-non-prototype"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). To fix that, this commit makes struct evcell to use int32_t as a callback (cfunc) argument of an event. int32_t is chosen because "event" function accepts "int32_t arg".
* sim/erc32: Insert void parameterTsukasa OI2022-10-291-3/+3
| | | | | | | | | | Clang generates a warning if there is a function declaration/definition with zero arguments. Such declarations/definitions without a prototype (an argument list) are deprecated forms of indefinite arguments ("-Wdeprecated-non-prototype"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). This commit replaces () with (void) to avoid this warning.
* sim/erc32: avoid dereferencing type-punned pointer warningsAndrew Burgess2022-10-192-6/+4
| | | | | | | | | | | | | | | | | | | | When building the erc32 simulator I get a few warnings like this: /tmp/build/sim/../../src/sim/erc32/exec.c:1377:21: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] 1377 | sregs->fs[rd] = *((float32 *) & ddata[0]); | ~^~~~~~~~~~~~~~~~~~~~~~~ The type of '& ddata[0]' will be 'uint32_t *', which is what triggers the warning. This commit makes use of memcpy when performing the type-punning, which resolves the above warnings. With this change, I now see no warnings when compiling exec.c, which means that the line in Makefile.in that disables -Werror can be removed. There should be no change in behaviour after this commit.
* sim/erc32: Add ATTRIBUTE_PRINTFTsukasa OI2022-10-112-2/+2
| | | | | | | | | | | Clang generates a warning if the format string of a printf-like function is not a literal ("-Wformat-nonliteral"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). To avoid warnings on the printf-like wrapper, it requires proper __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason. This commit adds ATTRIBUTE_PRINTF to the printf-like functions.
* sim/erc32: fix gdb with simulator buildAndrew Burgess2022-09-043-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit: commit 7b01c1cc1d111ba0afa51e60fa9842d3b971e2d1 Date: Mon Apr 4 22:38:04 2022 +0100 sim: fixes for libopcodes styled disassembler changes were made to the simulator source to handle the new libopcodes disassembler styling API. Unfortunately, these changes broke building GDB with the erc32 (sparc) simulator, like this: ../src/configure --target=sparc-linux make all-gdb .... /usr/bin/ld: ../sim/erc32/libsim.a(interf.o): in function `sim_open': /tmp/build/sim/../../src/sim/erc32/interf.c:247: undefined reference to `fprintf_styled' collect2: error: ld returned 1 exit status The problem is that in commit 7b01c1cc1d11 the fprintf_styled function was added into sis.c. This file is only used when building the 'run' binary, that is, the standalone simulator, and is not included in the libsim.a library. Now, the obvious fix would be to move fprintf_styled into libsim.a, however, that turns out to be tricky. The erc32 simulator currently has two copies of the function run_sim, one in sis.c, and one in interf.c, both of these copies are global. Currently, the 'run' binary links fine, though I suspect this might be pure luck. When I tried moving fprintf_styled into interf.c, I ran into multiple-definition (of run_sim) errors. I suspect that by requiring the linker to pull in fprintf_styled from libsim.a I was changing the order in which symbols were loaded, and the linker was now seeing both copies of run_sim, while currently we only see one copy. The ideal solution of course, would be to merge the two similar, but slightly different copies of run_sim, and just use the one copy. Then we could safely move fprintf_styled into interf.c too, and all would be good. But I don't have time right now to start debugging the erc32 simulator, so I wanted a solution that fixes the build without introducing multiple definition errors. The easiest solution I think is to just have two copies of fprintf_styled, one in sis.c, and one in interf.c. Unlike run_sim, these two copies are both static, so we will not run into multiple definition issues with this function. The functions themselves are not very big, so it's not a huge amount of duplicate code. I am very aware that this is not an ideal solution, and I would welcome anyone who wants to take on fixing the run_sim problem properly, and then cleanup the fprintf_styled duplication.
* Don't use BFD_VMA_FMT in gdb and simAlan Modra2022-08-061-2/+2
| | | | | | | Like commit b82817674f, this replaces BFD_VMA_FMT "x" in sim/ with PRIx64 and casts to promote bfd_vma to uint64_t. The one file using BFD_VMA_FMT in gdb/ instead now uses hex_string, and a typo in the warning message is fixed.
* sim: fixes for libopcodes styled disassemblerAndrew Burgess2022-04-043-2/+22
| | | | | | | | | | | | | | | | | | In commit: commit 60a3da00bd5407f07d64dff82a4dae98230dfaac Date: Sat Jan 22 11:38:18 2022 +0000 objdump/opcodes: add syntax highlighting to disassembler output I broke several sim/ targets by forgetting to update their uses of the libopcodes disassembler to take account of the new styled printing. These should all be fixed by this commit. I've not tried to add actual styled output to the simulator traces, instead, the styled print routines just ignore the style and print the output unstyled.
* sim: erc32: migrate to standard uintXX_t typesMike Frysinger2022-01-067-312/+305
| | | | | This old port setup its own uintXX types, but since we require C11 now, we can assume the standard uintXX_t types exist and use them.
* Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker2022-01-0111-11/+11
| | | | | | | | This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
* sim: use ## for automake commentsMike Frysinger2021-12-091-16/+16
| | | | | | The ## marker tells automake to not include the comment in its generated output, so use that in most places where the comment only makes sense in the inputs.
* sim: erc32: drop old configure targetMike Frysinger2021-12-041-8/+0
| | | | There is no configure script in here anymore to regenerate.
* sim: install various doc filesMike Frysinger2021-11-191-0/+19
|
* sim: erc32: reduce -Wno-error scopeMike Frysinger2021-11-011-2/+2
| | | | | | Only one file in here still generates warnings, so reduce the -Werror disable to that alone now that we require GNU make and can set variables on a per-object basis.
* sim: erc32: use silent build rules with sis linkageMike Frysinger2021-10-311-1/+1
|
* sim: erc32: fix a few more build warningsMike Frysinger2021-10-311-5/+8
| | | | | | | Tweak the if indentation & brace style to avoid ambiguous warnings. Add ATTRIBUTE_UNUSED to UART functions that aren't used when FAST_UART is defined (which is the default).
* sim: erc32: fix signedness compatibility and redefinition warningsOrgad Shaneh2021-10-314-25/+27
|
* sim: rename ChangeLog files to ChangeLog-2021Mike Frysinger2021-08-171-0/+0
| | | | | | | | | | | | | | Now that ChangeLog entries are no longer used for sim patches, this commit renames all relevant sim ChangeLog to ChangeLog-2021, similar to what we would do in the context of the "Start of New Year" procedure. The purpose of this change is to avoid people merging ChangeLog entries by mistake when applying existing commits that they are currently working on. Also throw in a .gitignore entry to keep people from adding new ChangeLog files anywhere in the sim tree.
* sim: erc32: use libsim.a for common objectsMike Frysinger2021-07-081-2/+2
| | | | | | | | We're starting to move more objects to the common build that sis did not need before, so linking them is causing problems (when common objects end up needing symbols from non-common objects). Switch it to the libsim.a archive which will allow the link to pull out only what it needs.
* sim: erc32: merge with common configure scriptMike Frysinger2021-06-275-4299/+5
| | | | | Move the unique library tests to the common code so we can delete the erc32 configure logic entirely.
* sim: drop configure scripts for simple portsMike Frysinger2021-06-222-0/+11
| | | | | | | | | These ports only use the pieces that have been unified, so we can merge them into the common configure script and get rid of their unique one entirely. We still compile & link separate run programs, and have dedicated subdir Makefiles, but the configure script portion is merged.
* sim: unify hardware settingsMike Frysinger2021-06-213-54/+5
| | | | | Move these options up to the common dir so we only test & export them once across all ports.
* sim: hw: rework configure option & device selectionMike Frysinger2021-06-212-38/+30
| | | | | | | | | | | | | | | | The sim-hardware configure option allows builders to select a set of device models to enable. But this seems like unnecessary overkill: the existence of individual device models doesn't affect performance at all as they are only enabled at runtime if the config uses them, and individually these are all <5KB a piece. Stripping off a total of ~50KB from a ~1MB binary doesn't seem useful, and it's extremely unlikely anyone will ever bother. So let's simplify the configure/make logic by turning sim-hardware into a boolean option like many of the other sim options. Any ports that have unique device models will declare them in their Makefile instead of at configure time. This will allow us to (eventually) unify the setting into the common dir.
* sim: delete SIM_AC_COMMON macroMike Frysinger2021-06-204-5/+5
| | | | | Now that we've moved all content out to the common file, this is empty and can be deleted it entirely.
* sim: unify general maintainer settingsMike Frysinger2021-06-202-124/+0
| | | | | | | Move these options up to the common dir so we only test & export them once across all ports. This takes a page from the cgen maint logic to make $(MAINT) work for non-automake Makefiles which will allow us to merge it together.
* sim: move sim-inline to the common codeMike Frysinger2021-06-203-36/+5
| | | | | This will allow us to build the common code with the same inline settings as the arch subdirs, and only do the test once.
* sim: unify gettext/intl probing logicMike Frysinger2021-06-192-85/+0
| | | | | Move these options up to the common dir so we only test & export them once across all ports.