Skip to content

Fixes to SYS_READ changes in PR #727 per review. (#729)#1

Merged
donmr merged 1 commit intodonmr:masterfrom
stlink-org:master
Jul 28, 2018
Merged

Fixes to SYS_READ changes in PR #727 per review. (#729)#1
donmr merged 1 commit intodonmr:masterfrom
stlink-org:master

Conversation

@donmr
Copy link
Owner

@donmr donmr commented Jul 28, 2018

  • Use local variable for read_result instead of *ret, and fix
    calculation of *ret for EOF case.

  • Found a problem when reading an odd (%4) number of bytes at the end
    of a file. fread (on stm32) get them (say 3 bytes), then askes for
    more. do_semihosting gets a read return of 0 and tries to write that.
    mem_write alters the address to be aligned and overwrites then 3 bytes
    from the last read.

This change simply tells mem_write to do nothing if len is 0.

* Use local variable for read_result instead of *ret, and fix
calculation of *ret for EOF case.

* Found a problem when reading an odd (%4) number of bytes at the end
of a file.  fread (on stm32) get them (say 3 bytes), then askes for
more.  do_semihosting gets a read return of 0 and tries to write that.
mem_write alters the address to be aligned and overwrites then 3 bytes
from the last read.

This change simply tells mem_write to do nothing if len is 0.

* Fix Issues from Fabien-Chouteau's review of my previous patch in isue #727.

* Revert change to mem_write() so it does not confuse fixes to do_semihosting().

* Add cast to avoid warning.
@donmr donmr merged commit bbf9642 into donmr:master Jul 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant