Skip to content
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

Broken build of examples? #62

Open
Jatsekku opened this issue Feb 10, 2022 · 2 comments
Open

Broken build of examples? #62

Jatsekku opened this issue Feb 10, 2022 · 2 comments

Comments

@Jatsekku
Copy link

Jatsekku commented Feb 10, 2022

I'm having hard time to compile provided examples (e.g. get-start/blink, get-start/helloworld). Apparently there is some linker problem.
Is it just me (or my env)? BTW, I would really appreciate some docs for SDK's build system.

For example (helloworld):

archlinux% cd bl_iot_sdk/customer_app/get-start/helloworld
archlinux% make
use existing version.mk file
LD build_out/helloworld.elf
/home/jatsekku/tmp/bl_iot_sdk/toolchain/riscv/Linux/bin/../lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/jatsekku/tmp/bl_iot_sdk/customer_app/get-start/helloworld/build_out/coredump/libcoredump.a(bl_coredump.o): in function `cd_putchar':
/home/jatsekku/bl_iot_sdk/components/stage/coredump/bl_coredump.c:192: undefined reference to `_sp_base'
/home/jatsekku/tmp/bl_iot_sdk/toolchain/riscv/Linux/bin/../lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/jatsekku/tmp/bl_iot_sdk/customer_app/get-start/helloworld/build_out/coredump/libcoredump.a(bl_coredump.o): in function `bl_coredump_print':
/home/jatsekku/bl_iot_sdk/components/stage/coredump/bl_coredump.c:409: undefined reference to `_sp_base'
collect2: error: ld returned 1 exit status
make: *** [/home/jatsekku/tmp/bl_iot_sdk/make_scripts_riscv/project.mk:470: /home/jatsekku/tmp/bl_iot_sdk/customer_app/get-start/helloworld/build_out/helloworld.elf] Error 1
archlinux%
@petergebruers
Copy link

petergebruers commented Feb 14, 2022

I was able to build "blink" and "helloworld" by setting this (I am on macOS):

export CONFIG_LINK_ROM=1

... then run make clean then make

This selects a different part in components/platform/soc/bl602/bl602/evb/evb.mk in the SDK which links components/platform/soc/bl602/bl602/evb/ld/flash_rom.ld

That flash_rom.ld file has a definition for "_sp_base":

  .stack (NOLOAD)   :
  {
    PROVIDE ( _sp_base = . );
    . = ALIGN(16);
    . = . + __stack_size;
    PROVIDE( _sp_main = . );
    __freertos_irq_stack_top = .;
  }

Other "ld" scripts in the seem to be lacking this PROVIDE ( _sp_base = . ); incantation, it might be possible to add it there and then don't use my workaround (the "export" trick).

IMHO the SDK has been refactored to accommodate the BL702 and my there was some collateral damage, but I am too new to this project to understand the in-and-outs.

And then building succeeds. I haven't flashed the resulting binary, I haven't finished soldering my BL602 module yet :)

@ntn888
Copy link

ntn888 commented Mar 15, 2022

the 'bl_iot_sdk/customer_app/get-start' is outdated...
i think one has to use the bl_iot_sdk/customer_app/peripheral/demo_gpio & bl_iot_sdk/customer_app/peripheral/demo_uart for the new updated applications...

i have opened an issue here to remove the get-start folder. i was also initially confused...

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

No branches or pull requests

3 participants