Skip to content

Commit

Permalink
Merge pull request #976 from riscv/from_upstream
Browse files Browse the repository at this point in the history
Merge up to d4575b6 from upstream
  • Loading branch information
timsifive authored Dec 21, 2023
2 parents feff8e0 + 1f512ea commit 62758f2
Show file tree
Hide file tree
Showing 57 changed files with 1,831 additions and 371 deletions.
130 changes: 130 additions & 0 deletions LICENSES/preferred/CC0-1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
Valid-License-Identifier: CC0-1.0
SPDX-URL: https://spdx.org/licenses/CC0-1.0.html
Usage-Guide:
To use the Creative Commons Zero v1.0 Universal License put the following
SPDX tag/value pair into a comment according to the placement guidelines in
the licensing rules documentation:
SPDX-License-Identifier: CC0-1.0
License-Text:

Creative Commons Legal Code

CC0 1.0 Universal

CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.

Statement of Purpose

The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").

Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.

For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.

1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:

i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.

2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.

3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.

4. Limitations and Disclaimers.

a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ EXTRA_DIST += \
LICENSES/preferred/BSD-2-Clause-Views \
LICENSES/preferred/BSD-3-Clause \
LICENSES/preferred/BSD-Source-Code \
LICENSES/preferred/CC0-1.0 \
LICENSES/preferred/GFDL-1.2 \
LICENSES/preferred/gfdl-1.2.texi.readme \
LICENSES/preferred/GPL-2.0 \
Expand Down
2 changes: 1 addition & 1 deletion contrib/rtos-helpers/FreeRTOS-openocd.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-License-Identifier: CC0-1.0

/*
* Since at least FreeRTOS V7.5.3 uxTopUsedPriority is no longer
Expand Down
18 changes: 15 additions & 3 deletions doc/openocd.texi
Original file line number Diff line number Diff line change
Expand Up @@ -5325,6 +5325,18 @@ Displays the current target state:
(Also, @pxref{eventpolling,,Event Polling}.)
@end deffn

@deffn {Command} {$target_name debug_reason}
Displays the current debug reason:
@code{debug-request},
@code{breakpoint},
@code{watchpoint},
@code{watchpoint-and-breakpoint},
@code{single-step},
@code{target-not-halted},
@code{program-exit},
@code{exception-catch} or @code{undefined}.
@end deffn

@deffn {Command} {$target_name eventlist}
Displays a table listing all event handlers
currently associated with this target.
Expand Down Expand Up @@ -9387,8 +9399,8 @@ for similar mechanisms that do not consume hardware breakpoints.)
Remove the breakpoint at @var{address} or all breakpoints.
@end deffn

@deffn {Command} {rwp} address
Remove data watchpoint on @var{address}
@deffn {Command} {rwp} @option{all} | address
Remove data watchpoint on @var{address} or all watchpoints.
@end deffn

@deffn {Command} {wp} [address len [(@option{r}|@option{w}|@option{a}) [value [mask]]]]
Expand Down Expand Up @@ -12709,7 +12721,7 @@ Return information about the flash banks
@item @b{capture} <@var{command}>

Run <@var{command}> and return full log output that was produced during
its execution. Example:
its execution together with the command output. Example:

@example
> capture "reset init"
Expand Down
6 changes: 4 additions & 2 deletions src/flash/nor/rsl10.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,8 @@ static const struct command_registration rsl10_exec_command_handlers[] = {
.help = "Mass erase all unprotected flash areas",
.usage = "",
},
COMMAND_REGISTRATION_DONE};
COMMAND_REGISTRATION_DONE
};

static const struct command_registration rsl10_command_handlers[] = {
{
Expand All @@ -825,7 +826,8 @@ static const struct command_registration rsl10_command_handlers[] = {
.usage = "",
.chain = rsl10_exec_command_handlers,
},
COMMAND_REGISTRATION_DONE};
COMMAND_REGISTRATION_DONE
};

const struct flash_driver rsl10_flash = {
.name = "rsl10",
Expand Down
25 changes: 21 additions & 4 deletions src/flash/nor/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,22 @@
/* Shared table of known SPI flash devices for SPI-based flash drivers. Taken
* from device datasheets and Linux SPI flash drivers. */
const struct flash_device flash_devices[] = {
/* name, read_cmd, qread_cmd, pprog_cmd, erase_cmd, chip_erase_cmd, device_id,
* pagesize, sectorsize, size_in_bytes
* note: device id is usually 3 bytes long, however the unused highest byte counts
* continuation codes for manufacturer id as per JEP106xx */
/* Note: device_id is usually 3 bytes long, however the unused highest byte counts
* continuation codes for manufacturer id as per JEP106xx.
*
* All sizes (page, sector/block and flash) are in bytes.
*
* Guide to select a proper erase command (if both sector and block erase cmds are available):
* Use 4kbit sector erase cmd and set erase size to the size of sector for small devices
* (4Mbit and less, size <= 0x80000) to prevent too raw erase granularity.
* Use 64kbit block erase cmd and set erase size to the size of block for bigger devices
* (8Mbit and more, size >= 0x100000) to keep erase speed reasonable.
* If the device implements also 32kbit block erase, use it for 8Mbit, size == 0x100000.
*/
/* name read qread page erase chip device_id page erase flash
* _cmd _cmd _prog _cmd* _erase size size* size
* _cmd _cmd
*/
FLASH_ID("st m25pe10", 0x03, 0x00, 0x02, 0xd8, 0x00, 0x00118020, 0x100, 0x10000, 0x20000),
FLASH_ID("st m25pe20", 0x03, 0x00, 0x02, 0xd8, 0x00, 0x00128020, 0x100, 0x10000, 0x40000),
FLASH_ID("st m25pe40", 0x03, 0x00, 0x02, 0xd8, 0x00, 0x00138020, 0x100, 0x10000, 0x80000),
Expand Down Expand Up @@ -174,6 +186,11 @@ const struct flash_device flash_devices[] = {
FLASH_ID("zetta zd25q16", 0x03, 0x00, 0x02, 0xd8, 0xc7, 0x001560ba, 0x100, 0x10000, 0x200000),

/* FRAM, no erase commands, no write page or sectors */

/* name read qread page device_id total
* _cmd _cmd _prog size
* _cmd
*/
FRAM_ID("fu mb85rs16n", 0x03, 0, 0x02, 0x00010104, 0x800),
FRAM_ID("fu mb85rs32v", 0x03, 0, 0x02, 0x00010204, 0x1000), /* exists ? */
FRAM_ID("fu mb85rs64v", 0x03, 0, 0x02, 0x00020304, 0x2000),
Expand Down
26 changes: 14 additions & 12 deletions src/helper/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ static struct log_capture_state *command_log_capture_start(Jim_Interp *interp)
* The tcl return value is empty for openocd commands that provide
* progress output.
*
* Therefore we set the tcl return value only if we actually
* captured output.
* For other commands, we prepend the logs to the tcl return value.
*/
static void command_log_capture_finish(struct log_capture_state *state)
{
Expand All @@ -109,15 +108,18 @@ static void command_log_capture_finish(struct log_capture_state *state)

log_remove_callback(tcl_output, state);

int length;
Jim_GetString(state->output, &length);
int loglen;
const char *log_result = Jim_GetString(state->output, &loglen);
int reslen;
const char *cmd_result = Jim_GetString(Jim_GetResult(state->interp), &reslen);

if (length > 0)
Jim_SetResult(state->interp, state->output);
else {
/* No output captured, use tcl return value (which could
* be empty too). */
}
// Just in case the log doesn't end with a newline, we add it
if (loglen != 0 && reslen != 0 && log_result[loglen - 1] != '\n')
Jim_AppendString(state->interp, state->output, "\n", 1);

Jim_AppendString(state->interp, state->output, cmd_result, reslen);

Jim_SetResult(state->interp, state->output);
Jim_DecrRefCount(state->interp, state->output);

free(state);
Expand Down Expand Up @@ -691,8 +693,8 @@ COMMAND_HANDLER(handle_echo)
return ERROR_OK;
}

/* Capture progress output and return as tcl return value. If the
* progress output was empty, return tcl return value.
/* Return both the progress output (LOG_INFO and higher)
* and the tcl return value of a command.
*/
static int jim_capture(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
Expand Down
55 changes: 51 additions & 4 deletions src/helper/jep106.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

/*
* The manufacturer's standard identification code list appears in JEP106.
* Copyright (c) 2022 JEDEC. All rights reserved.
* Copyright (c) 2023 JEDEC. All rights reserved.
*
* JEP106 is regularly updated. For the current manufacturer's standard
* identification code list, please visit the JEDEC website at www.jedec.org .
*/

/* This file is aligned to revision JEP106BG May 2023. */
/* This file is aligned to revision JEP106BH September 2023. */

/* "NXP (Philips)" is reported below, while missing in JEP106BG */
/* "NXP (Philips)" is reported below, while missing since JEP106BG */

[0][0x01 - 1] = "AMD",
[0][0x02 - 1] = "AMI",
Expand Down Expand Up @@ -1375,7 +1375,7 @@
[10][0x65 - 1] = "Esperanto Technologies",
[10][0x66 - 1] = "JinSheng Electronic (Shenzhen) Co Ltd",
[10][0x67 - 1] = "Shenzhen Shi Bolunshuai Technology",
[10][0x68 - 1] = "Shanghai Rei Zuan Information Tech",
[10][0x68 - 1] = "Shanghai Rui Zuan Information Tech",
[10][0x69 - 1] = "Fraunhofer IIS",
[10][0x6a - 1] = "Kandou Bus SA",
[10][0x6b - 1] = "Acer",
Expand Down Expand Up @@ -1841,4 +1841,51 @@
[14][0x3f - 1] = "Shenzhen Dingsheng Technology Co Ltd",
[14][0x40 - 1] = "EVAS Intelligence Co Ltd",
[14][0x41 - 1] = "Kaibright Electronic Technologies",
[14][0x42 - 1] = "Fraunhofer IMS",
[14][0x43 - 1] = "Shenzhen Xinrui Renhe Technology",
[14][0x44 - 1] = "Beijing Vcore Technology Co Ltd",
[14][0x45 - 1] = "Silicon Innovation Technologies Co Ltd",
[14][0x46 - 1] = "Shenzhen Zhengxinda Technology Co Ltd",
[14][0x47 - 1] = "Shenzhen Remai Electronics Co Lttd",
[14][0x48 - 1] = "Shenzhen Xinruiyan Electronics Co Ltd",
[14][0x49 - 1] = "CEC Huada Electronic Design Co Ltd",
[14][0x4a - 1] = "Westberry Technology Inc",
[14][0x4b - 1] = "Tongxin Microelectronics Co Ltd",
[14][0x4c - 1] = "UNIM Semiconductor (Shang Hai) Co Ltd",
[14][0x4d - 1] = "Shenzhen Qiaowenxingyu Industrial Co Ltd",
[14][0x4e - 1] = "ICC",
[14][0x4f - 1] = "Enfabrica Corporation",
[14][0x50 - 1] = "Niobium Microsystems Inc",
[14][0x51 - 1] = "Xiaoli AI Electronics (Shenzhen) Co Ltd",
[14][0x52 - 1] = "Silicon Mitus",
[14][0x53 - 1] = "Ajiatek Inc",
[14][0x54 - 1] = "HomeNet",
[14][0x55 - 1] = "Shenzhen Shubang Technology Co Ltd",
[14][0x56 - 1] = "Exacta Technologies Ltd",
[14][0x57 - 1] = "Synology",
[14][0x58 - 1] = "Trium Elektronik Bilgi Islem San Ve Dis",
[14][0x59 - 1] = "Shenzhen Hippstor Technology Co Ltd",
[14][0x5a - 1] = "SSCT",
[14][0x5b - 1] = "Sichuan Heentai Semiconductor Co Ltd",
[14][0x5c - 1] = "Zhejiang University",
[14][0x5d - 1] = "www.shingroup.cn",
[14][0x5e - 1] = "Suzhou Nano Mchip Technology Company",
[14][0x5f - 1] = "Feature Integration Technology Inc",
[14][0x60 - 1] = "d-Matrix",
[14][0x61 - 1] = "Golden Memory",
[14][0x62 - 1] = "Qingdao Thunderobot Technology Co Ltd",
[14][0x63 - 1] = "Shenzhen Tianxiang Chuangxin Technology",
[14][0x64 - 1] = "HYPHY USA",
[14][0x65 - 1] = "Valkyrie",
[14][0x66 - 1] = "Suzhou Hesetc Electronic Technology Co",
[14][0x67 - 1] = "Hainan Zhongyuncun Technology Co Ltd",
[14][0x68 - 1] = "Shenzhen Yousheng Bona Technology Co",
[14][0x69 - 1] = "Shenzhen Xinle Chuang Technology Co",
[14][0x6a - 1] = "DEEPX",
[14][0x6b - 1] = "iStarChip CA LLC",
[14][0x6c - 1] = "Shenzhen Vinreada Technology Co Ltd",
[14][0x6d - 1] = "Novatek Microelectronics Corp",
[14][0x6e - 1] = "Chemgdu EG Technology Co Ltd",
[14][0x6f - 1] = "AGI Technology",
[14][0x70 - 1] = "Syntiant",
/* EOF */
2 changes: 1 addition & 1 deletion src/jtag/drivers/angie.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ static int angie_usb_open(struct angie *device)
const uint16_t vids[] = {ANGIE_VID, ANGIE_VID, ANGIE_VID, ANGIE_VID, 0};
const uint16_t pids[] = {ANGIE_PID, ANGIE_PID_2, ANGIE_PID_3, ANGIE_PID_4, 0};

int ret = jtag_libusb_open(vids, pids, &usb_device_handle, NULL);
int ret = jtag_libusb_open(vids, pids, NULL, &usb_device_handle, NULL);

if (ret != ERROR_OK)
return ret;
Expand Down
2 changes: 1 addition & 1 deletion src/jtag/drivers/arm-jtag-ew.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ static struct armjtagew *armjtagew_usb_open(void)
const uint16_t pids[] = { USB_PID, 0 };
struct libusb_device_handle *dev;

if (jtag_libusb_open(vids, pids, &dev, NULL) != ERROR_OK)
if (jtag_libusb_open(vids, pids, NULL, &dev, NULL) != ERROR_OK)
return NULL;

struct armjtagew *result = malloc(sizeof(struct armjtagew));
Expand Down
2 changes: 1 addition & 1 deletion src/jtag/drivers/bcm2835gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ COMMAND_HANDLER(bcm2835gpio_handle_peripheral_base)
}

tmp_base = bcm2835_peri_base;
command_print(CMD, "BCM2835 GPIO: peripheral_base = 0x%08" PRIu64,
command_print(CMD, "BCM2835 GPIO: peripheral_base = 0x%08" PRIx64,
tmp_base);
return ERROR_OK;
}
Expand Down
Loading

0 comments on commit 62758f2

Please sign in to comment.