-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve mixing usage fileio
and fileXio
#471
Conversation
fileio
fileXio`fileio
fileXio`
d4eee65
to
4a5d65f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These set of changes are in a good direction.
LGTM
514a0a7
to
658e125
Compare
ccd0c08
to
307232b
Compare
fileio
fileXio`fileio
fileXio`
ee/libcglue/include/file-advanced.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this header shouldn't be here, but I would like to hear your opinions... @rickgaiser and @uyjulian
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe ps2sdk-libcglue.h
?
fileio
fileXio`fileio
and fileXio
307232b
to
1e4a354
Compare
ee/libcglue/src/fdman.h
Outdated
@@ -14,7 +14,7 @@ | |||
|
|||
#define _FDMAN_H_ | |||
|
|||
#define __FILENO_MAX 1024 | |||
#define __FILENO_MAX 64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is crucial to save RAM, what do you think should be a good number here?
I would say that 64 is fair enough....
17b4dd0
to
57c3200
Compare
57c3200
to
b9be021
Compare
Description
The main scope of this PR is to avoid having unused functions within the embedded ELF, unfortunately, the linker and compiler aren't that clever and require some help to make it work better.
More concretely most of the unused functions belong to the library used for performing IO operations, either
fileio
orfileXio
. Having both in the binary first makes the a waste of space, and secondly could deal with problems if you start mixing by mistakefd
from/tofileio
/filexio
.How I did it:
rom0_info
contains some information about theROM0
included in the console, it was always usingfileio
for accessing theROM0
content, now, I have created a possibility to inject via driver the functions used to deal with IO operations.osd_config
used functions fromrom0_info
, so the same strategy was created here.osd_config
, it was using some_libcglue_timezone_update
functions, and it shouldn't, becauselibkernel.a
shouldn't have any kind of dependency, for still allowing a way of using it withoutnewlib
. In order to facilitate the usage of these logic to the final user, I have created 2 new functions inps2sdkapi.h
file,ps2sdk_setTimezone
andps2sdk_setDaylightSaving
which automatically will use the proper IO library and the expected callback to_libcglue_timezone_update
._libcglue_timezone_update
used thoseosd_config
functions, so now it injects the driver with the proper IO functions. Additionally, the logic for setting the timezone was updated having as reference howPSP
did._ps2sdk_XXX
functions, now have changed. Previously we set by defaultfileIO
functions, and then later on, it was replaced withfileXio
functions. Now, however, they haveNULL
value as default, and thenweak
functions called__set_ps2sdk_XXX
pointing tofileIO
have been created; thenstrong
functions pointing tofileXio
have been created, in the way that as soon as the user link the binary withfileXio
automatically all thefileio
functions will be removed from the binary. All these functions must be called before the_ps2sd_XXX
is used. This also require to do an extra trick to make it work, https://stackoverflow.com/a/22178564fileXio
EE library has been improved, it now has a specific compilation per function, and it helps to link and strip unused symbols. Other not needed functions were removed.fileXio
usage has been created.Results:
filesystem
sample fromps2_drivers
https://github.com/fjtrujy/ps2_drivers/tree/main/samples/filesystem_sampleIt reduces
15KB
when the binary contains debug symbols, 11KB when the binary is stripped, and 2.6KB when the binary is packed.EE_CFLAGS += -fdata-sections -ffunction-sections -flto
andEE_LDFLAGS += -fdata-sections -ffunction-sections -flto -Wl,--gc-sections
) flags:Finally, I would like some of you to test those improvements, to fully assure that everything is working as expected. Especially OPL which is the most critical piece of software we actually support.