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

build the miniblink Error for stm32f4-discovery #159

Closed
feathertw opened this issue Oct 11, 2017 · 1 comment
Closed

build the miniblink Error for stm32f4-discovery #159

feathertw opened this issue Oct 11, 2017 · 1 comment

Comments

@feathertw
Copy link

I'm the new learner for libopencm3, I use ubuntu14.04 environment.
I found that's really strange that I cannot build the example "miniblink"
my step are here, then there is error message,
but the same step and build tick_blink, it will success,
I don't know why

git clone https://github.com/libopencm3/libopencm3-examples.git
cd ./libopencm3-examples
git submodule init
git submodule update
cd libopencm3/
make
cd ../examples/stm32/f4/stm32f4-discovery/miniblink/
make

the error message like this

arm-none-eabi/bin/ld:generated.STM32F407VG.ld:16: warning: memory region `rom' not declared
arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld: invalid origin for memory region ram
collect2: error: ld returned 1 exit status
make: *** [miniblink.elf] Error 1

and generated.STM32F407VG.ld is

EXTERN(vector_table)
ENTRY(reset_handler)
MEMORY
{
 ram (rwx) : ORIGIN = _RAM_OFF, LENGTH = _RAM
}
SECTIONS
{
 .text : {
  *(.vectors)
  *(.text*)
  . = ALIGN(4);
  *(.rodata*)
  . = ALIGN(4);
 } >rom
 .preinit_array : {
  . = ALIGN(4);
  __preinit_array_start = .;
  KEEP (*(.preinit_array))
  __preinit_array_end = .;
 } >rom
 .init_array : {
  . = ALIGN(4);
  __init_array_start = .;
  KEEP (*(SORT(.init_array.*)))
  KEEP (*(.init_array))
  __init_array_end = .;
 } >rom
 .fini_array : {
  . = ALIGN(4);
  __fini_array_start = .;
  KEEP (*(.fini_array))
  KEEP (*(SORT(.fini_array.*)))
  __fini_array_end = .;
 } >rom
 .ARM.extab : {
  *(.ARM.extab*)
 } >rom
 .ARM.exidx : {
  __exidx_start = .;
  *(.ARM.exidx*)
  __exidx_end = .;
 } >rom
 . = ALIGN(4);
 _etext = .;
 .data : {
  _data = .;
  *(.data*)
  . = ALIGN(4);
  _edata = .;
 } >ram AT >rom
 _data_loadaddr = LOADADDR(.data);
 .bss : {
  *(.bss*)
  *(COMMON)
  . = ALIGN(4);
  _ebss = .;
 } >ram
 /DISCARD/ : { *(.eh_frame) }
 . = ALIGN(4);
 end = .;
}
PROVIDE(_stack = ORIGIN(ram) + LENGTH(ram));

then if I change a part of linker script, it will work successfully,

MEMORY
{
	rom (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
	ram (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
}
@karlp
Copy link
Member

karlp commented Oct 11, 2017

You're hitting libopencm3/libopencm3#731 The solution is to get gnu awk, instead of mawk, or rewrite the generator to use more portable parts of awk. (that's what libopencm3/libopencm3#732 is filed for)

Only examples that use the linker script generation will hit this. ie, defining DEVICE=xxxxx instead of defining LDSCRIPT

@karlp karlp closed this as completed Oct 11, 2017
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

2 participants