Skip to content

enormous .BSS size while building tests/subsys/fs/nffs_fs_api #12065

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

Closed
nvlsianpu opened this issue Dec 13, 2018 · 4 comments
Closed

enormous .BSS size while building tests/subsys/fs/nffs_fs_api #12065

nvlsianpu opened this issue Dec 13, 2018 · 4 comments
Assignees
Labels
area: Userspace Userspace bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@nvlsianpu
Copy link
Collaborator

nvlsianpu commented Dec 13, 2018

Describe the bug
While building the test suite for nrf52840_pca10056 encountered oversize of SRAM. last logg I've got is

-- Build files have been written to: /home/anpu/codedev/zephyr/tests/subsys/fs/nffs_fs_api/basic/build/nrf52840_pca10056
[196/216] Linking C executable zephyr/priv_stacks_prebuilt.elf
FAILED: zephyr/priv_stacks_prebuilt.elf
: && ccache /opt/zephyr-sdk-0.9.5/sysroots/x86_64-pokysdk-linux/usr/bin/arm-zephyr-eabi/arm-zephyr-eabi-gcc    zephyr/CMakeFiles/priv_stacks_prebuilt.dir/misc/empty_file.c.obj  -o zephyr/priv_stacks_prebuilt.elf  -T zephyr/linker_priv_stacks.cmd -Wl,-Map=/home/anpu/codedev/zephyr/tests/subsys/fs/nffs_fs_api/basic/build/nrf52840_pca10056/zephyr/zephyr.map -u_OffsetAbsSyms -u_ConfigAbsSyms -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/arm/core/libarch__arm__core.a zephyr/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a zephyr/arch/arm/core/cortex_m/mpu/libarch__arm__core__cortex_m__mpu.a zephyr/lib/libc/minimal/liblib__libc__minimal.a zephyr/ext/fs/nffs/libext__fs__nffs.a zephyr/subsys/bluetooth/common/libsubsys__bluetooth__common.a zephyr/subsys/bluetooth/host/libsubsys__bluetooth__host.a zephyr/subsys/bluetooth/controller/libsubsys__bluetooth__controller.a zephyr/subsys/fs/libsubsys__fs.a zephyr/subsys/net/libsubsys__net.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/flash/libdrivers__flash.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/entropy/libdrivers__entropy.a zephyr/tests/ztest/libtests__ztest.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a zephyr/CMakeFiles/offsets.dir/arch/arm/core/offsets/offsets.c.obj -L"/opt/zephyr-sdk-0.9.5/sysroots/armv5-zephyr-eabi/usr/lib/arm-zephyr-eabi/6.2.0/armv7e-m" -L/home/anpu/codedev/zephyr/tests/subsys/fs/nffs_fs_api/basic/build/nrf52840_pca10056/zephyr -lgcc -mthumb -nostdlib -static -no-pie -Wl,-X -Wl,-N -Wl,--gc-sections -Wl,--build-id=none -Wl,--orphan-handling=warn -mabi=aapcs && :
/opt/zephyr-sdk-0.9.5/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-zephyr-eabi/gcc/arm-zephyr-eabi/6.2.0/real-ld: zephyr/priv_stacks_prebuilt.elf section `bss' will not fit in region `SRAM'
/opt/zephyr-sdk-0.9.5/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-zephyr-eabi/gcc/arm-zephyr-eabi/6.2.0/real-ld: region `SRAM' overflowed by 61838 bytes
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Generally this test used to consume lot of RAM - but oversize by 60 KB is very unlikely for something which previously fit into memory.

To Reproduce
build the test against nrf52840_pca10056 using current master
(I have used 5ea8454)

Additional context
Build without user space memory fit into SRAM - so succeed
CONFIG_TEST_USERSPACE=n
CONFIG_APPLICATION_MEMORY=n
Is this a resolution or just hotfix?

@nvlsianpu nvlsianpu added bug The issue is a bug, or the PR is fixing a bug area: Userspace Userspace labels Dec 13, 2018
@nashif nashif added the priority: medium Medium impact/importance bug label Jan 10, 2019
@carlescufi carlescufi assigned ioannisg and unassigned carlescufi Jan 15, 2019
@carlescufi
Copy link
Member

carlescufi commented Jan 15, 2019

@andrewboie @ioannisg

I cheated by adding more "virtual RAM" and generated ram_report for both userspace and no userspace, but I have no real clue where the RAM is going.

ram_report:
userspace.txt
no-userspace.txt

.map files:
userspace.map.txt
no-userspace.map.txt

@andyross
Copy link
Collaborator

This looks roughly as expected to me. ARM's MPU requires power-of-two sized regions, and the application data in this app looks to me like it wants a little over 176k of space. That needs to be rounded up to a 256k area, and then sit adjacent to a region containing the rest of the kernel, and also to other regions containing stacks (I'm not the expert on how these are laid out). Needless to say, none of that stuff is going to fit when the app alone wants to use the entire SRAM.

Assuming I didn't mix up the numbers, this app won't work with userspace on this board as written. It either needs to shrink to fit the constraints of how the MPU works, or just configure out the userspace setting with an appropriate comment explaining the issue.

@galak
Copy link
Collaborator

galak commented Jan 15, 2019

Not sure about the userspace stuff as I can't get it to build if I set:

CONFIG_TEST_USERSPACE=n
CONFIG_APPLICATION_MEMORY=n

However, the test has a lot of memory / ram buffers:

common/test_ram_backend.c:static u8_t rambuf[FLASH_AREA_STORAGE_SIZE];
common/nffs_test_utils.c:#define AREA_BUF_MAX_SIZE (128 * 1024)

So that's 144K right off the top of SRAM.

  • k

@andrewboie
Copy link
Contributor

stuff is getting rounded up to the nearest power of 2 size due to the way the MPU works.
just set CONFIG_TEST_USERSPACE=n in the prj.conf for this test, you should be good

carlescufi added a commit to carlescufi/zephyr that referenced this issue Jan 16, 2019
NFFS tests do not fit in RAM on nRF5x, tweak the configurations so that
they do.

Fixes: zephyrproject-rtos#12065

Signed-off-by: Carles Cufi <[email protected]>
galak pushed a commit that referenced this issue Jan 17, 2019
NFFS tests do not fit in RAM on nRF5x, tweak the configurations so that
they do.

Fixes: #12065

Signed-off-by: Carles Cufi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Userspace Userspace bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

No branches or pull requests

7 participants