Skip to content

Arm runtime library _sys_read(): only error indicator is "-1" #60

@andbararm

Description

@andbararm

For the Arm Compiler runtime library there is an issue with the error handling in the CMSIS-Compiler pack. In particular the code in retarget-io.c -> _sys_read():

  rval = rt_fs_read(fh, buf, len);
  if (rval < 0) {
    errno = rval;
  } ...

causes an endless loop of retries, when some other error value than -1 is returned. The Arm runtime library only supports -1 as error indicator as seen in the comments in rt_sys.h. So changing the code to:

  rval = rt_fs_read(fh, buf, len);
  if (rval < 0) {
    errno = rval;
    rval = -1 ;
  } ...

causes the code to exit in the error case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions