MATLAB Answers

Lego NXT in simulink, "region ram is full"

1 view (last 30 days)
Fredrik Norell
Fredrik Norell on 30 Aug 2012
Hi,
I am trying to program a simple MPC controller into my NXT brick, using the Simulink run on target hardware, and the MPC Toolbox.
When the model is being downloaded I get the following error:
_____________________________________________________________________________
The call to realtime_make_rtw_hook, during the after_make hook generated the following error:
The build failed with the following message: "Evaluating prebuild target"
"C:/Matlab/R2012a/targets/nxtOSEK/toppers_osek/sg/sg" ./mine.oil -os=ECC2 -IC:/Matlab/R2012a/targets/nxtOSEK/toppers_osek/sg/impl_oil -template=C:/Matlab/R2012a/targets/nxtOSEK/toppers_osek/sg/lego_nxt.sgt
""/cygdrive/C/Matlab/R2012a/targets/GNU_ARM_Compiler/bin/arm-elf-gcc"" -I"C:\Users\Fredrik\Documents\MATLAB\Exjobb\Modelling\MPC test Lego\mpc_test_lego_rtt" -I"C:\Users\Fredrik\Documents\MATLAB\Exjobb\Modelling\MPC test Lego" -I"C:\Users\Fredrik\Documents\MATLAB\Exjobb\Prototyp MPC" -I"C:\Program Files\Matlab\R2012a\extern\include" -I"C:\Program Files\Matlab\R2012a\simulink\include" -I"C:\Program Files\Matlab\R2012a\rtw\c\src" -I"C:\Program Files\Matlab\R2012a\rtw\c\src\ext_mode\common" -I"C:\Program Files\Matlab\R2012a\rtw\c\ert" -I"C:\Matlab\R2012a\targets\lego\include" -D"MODEL=mpc_test_lego" -D"NUMST=2" -D"NCSTATES=3" -D"HAVESTDIO=" -D"ONESTEPFCN=0" -D"TERMFCN=1" -D"MAT_FILE=0" -D"MULTI_INSTANCE_CODE=0" -D"INTEGER_CODE=0" -D"MT=0" -D"TID01EQ=1" -c -ffreestanding -fsigned-char -mcpu=arm7tdmi -Os -Winline -Wall -Werror-implicit-function-declaration --param max-inline-insns-single=1000 -mthumb -mthumb-interwork -ffunction-sections -fdata-sections -iquote /cygdrive/C/Matlab/R2012a/targets/nxtOSEK/lejos_nxj/src/nxtvm/platform/nxt -iquote /cygdrive/C/Matlab/R2012a/targets/nxtOSEK/lejos_nxj/src/nxtvm/javavm -iquote /cygdrive/C/Matlab/R2012a/targets/nxtOSEK/ecrobot/bios -iquote /cygdrive/C/Matlab/R2012a/targets/nxtOSEK/ecrobot -iquote /cygdrive/C/Matlab/R2012a/targets/nxtOSEK/ecrobot/c -iquote /cygdrive/C/Matlab/R2012a/targets/nxtOSEK/c++ -I. -I/cygdrive/C/Matlab/R2012a/targets/nxtOSEK/toppers_osek/kernel -I/cygdrive/C/Matlab/R2012a/targets/nxtOSEK/toppers_osek/include -I/cygdrive/C/Matlab/R2012a/targets/nxtOSEK/toppers_osek/config/at91sam7s-gnu -I/cygdrive/C/Matlab/R2012a/targets/nxtOSEK/toppers_osek/config/at91sam7s-gnu/lego_nxt -I/cygdrive/C/Matlab/R2012a/targets/nxtOSEK/toppers_osek/sg -I/cygdrive/C/Matlab/R2012a/targets/nxtOSEK/toppers_osek/syslib/at91sam7s-gnu/lego_nxt -DLEGO -std=gnu99 ./kernel_cfg.c ./ecrobot.c ./ecrobot_bluetooth.c ./ecrobot_base.c ./ecrobot_init.s ./nxt_binary_header.s ./nxt_entry_point.s ./syscalls.c ./vectors.s ./cpu_config.c ./cpu_support.S ./debug.S ./irq.s ./sys_config.c ./sys_support.S ./alarm.c ./event.c ./interrupt.c ./osctl.c ./resource.c ./task.c ./task_manage.c ./hw_sys_timer.c ./ert_main.c ./mpc_test_lego.c ./mpc_test_lego_data.c ./rtGetInf.c ./rtGetNaN.c ./rt_nonfinite.c
./ecrobot_bluetooth.c: In function ‘connect_bt_master’:
./ecrobot_bluetooth.c:571: warning: unused variable ‘dummy’
./mpc_test_lego.c: In function ‘mpc_test_lego_output’:
./mpc_test_lego.c:3026: warning: ‘eiprcfwny2[0]’ may be used uninitialized in this function
./mpc_test_lego.c:3026: warning: ‘eiprcfwny2[1]’ may be used uninitialized in this function
""/cygdrive/C/Matlab/R2012a/targets/GNU_ARM_Compiler/bin/arm-elf-g++"" ./kernel_cfg.o ./ecrobot.o ./ecrobot_bluetooth.o ./ecrobot_base.o ./ecrobot_init.o ./nxt_binary_header.o ./nxt_entry_point.o ./syscalls.o ./vectors.o ./cpu_config.o ./cpu_support.o ./debug.o ./irq.o ./sys_config.o ./sys_support.o ./alarm.o ./event.o ./interrupt.o ./osctl.o ./resource.o ./task.o ./task_manage.o ./hw_sys_timer.o ./ert_main.o ./mpc_test_lego.o ./mpc_test_lego_data.o ./rtGetInf.o ./rtGetNaN.o ./rt_nonfinite.o -nostartfiles -o ./MW/mpc_test_lego.elf -T ./mine.ld -mthumb -mthumb-interwork -Wl,--allow-multiple-definition -Wl,--gc-sections -L/cygdrive/C/Matlab/R2012a/targets/nxtOSEK/lejos_nxj/src/nxtvm/platform/nxt -L/cygdrive/C/Matlab/R2012a/targets/nxtOSEK/lejos_nxj/src/nxtvm/javavm -L/cygdrive/C/Matlab/R2012a/targets/nxtOSEK/ecrobot/bios -L/cygdrive/C/Matlab/R2012a/targets/nxtOSEK/ecrobot -L/cygdrive/C/Matlab/R2012a/targets/nxtOSEK/ecrobot/c -L/cygdrive/C/Matlab/R2012a/targets/nxtOSEK/c++ -lm -llejososek -lecrobot
/cygdrive/C/Matlab/R2012a/targets/GNU_ARM_Compiler/bin/../lib/gcc/arm-elf/4.0.2/../../../../arm-elf/bin/ld: region ram is full (./MW/mpc_test_lego.elf section .text)
/cygdrive/C/Matlab/R2012a/targets/GNU_ARM_Compiler/bin/../lib/gcc/arm-elf/4.0.2/../../../../arm-elf/bin/ld: section .bss [00200040 -> 0020127f] overlaps section .entry [00200040 -> 0020007f]
/cygdrive/C/Matlab/R2012a/targets/GNU_ARM_Compiler/bin/../lib/gcc/arm-elf/4.0.2/../../../../arm-elf/bin/ld: section .heap_area [00201280 -> 0020fb77] overlaps section .ram_text [00200300 -> 00202a6f]
/cygdrive/C/Matlab/R2012a/targets/GNU_ARM_Compiler/bin/../lib/gcc/arm-elf/4.0.2/../../../../arm-elf/bin/ld: section .stack [0020fb78 -> 0020ffff] overlaps section .text [00203530 -> 00212f9f]
collect2: ld returned 1 exit status
mpc_test_lego.mk:141: recipe for target `MW/mpc_test_lego.elf' failed
make: *** [MW/mpc_test_lego.elf] Error 1
The build process will terminate as a result.
_____________________________________________________________________________
I'm guessing the important part is at the bottom where it says:
../arm-elf/bin/ld: region ram is full (./MW/mpc_test_lego.elf section .text)
../arm-elf/bin/ld: section .bss [00200040 -> 0020127f] overlaps section .entry [00200040 -> 0020007f]
../arm-elf/bin/ld: section .heap_area [00201280 -> 0020fb77] overlaps section .ram_text [00200300 -> 00202a6f]
../arm-elf/bin/ld: section .stack [0020fb78 -> 0020ffff] overlaps section .text [00203530 -> 00212f9f]
I read about a bug in the BrickOS ( http://sourceforge.net/tracker/?func=detail&aid=1493556&group_id=58151&atid=486699) that seemed to be generating the errors that I get, and for that there was a patch.
I should add that the mdl-file I'm trying to run on the NXT brick is small. It just contains a MPC controller block and a state-space. I have been able to run quite large programs before, including a Kalman filter and many sensors and motors.
Is this a known problem in the Simulink support for Lego Mindstorm? And can I do something about it?
regards, Fredrik

  1 Comment

Alexander
Alexander on 7 Jun 2013
Dear Rolfe,
I am working now on my Thesis in Germany and have to programm a Lego NXT made roboter with the VU-LRT Toolbox. I made already some schorts programm but they didn't work. May be you could help me. I received always the same error:
1-The call to lrt_make_rtw_hook, during the after_make hook generated the following error: Build failed during Make all
The build process will terminate as a result.
2-Build failed during Make all
3-Parsing successful for chart: "Messwerte/Packet"(#21)
Please could you help me Thank you for all
Alex

Sign in to comment.

Answers (2)

Rolfe Dlugy-Hegwer
Rolfe Dlugy-Hegwer on 31 Aug 2012
Edited: Rolfe Dlugy-Hegwer on 31 Aug 2012
Hi Frederik. Thanks for asking. Here are some basic troubleshooting questions. Did you: * Use Target Installer to update the firmware on the NXT? * Use the interface on the NXT to delete all programs and make room in the memory? * Enable External mode? If so, did you configure a Bluetooth connection? * Use a Model block (model reference) in your model?

  2 Comments

Fredrik Norell
Fredrik Norell on 6 Sep 2012
Thanks for your answer. I have tried updating the firmware and deleted all programs on the NXT. I am not running in external mode, since I want to use bluetooth communication between bricks. It seems you cannot have both.
I don't use a model reference in my model, is that something that could help?
Rolfe Dlugy-Hegwer
Rolfe Dlugy-Hegwer on 6 Sep 2012
Hi Fredrik. Thanks for following up.
Using a model block won't solve this issue. To help future readers, I've rephrased my questions as recommendations and identified the steps you've completed:
  • Use Target Installer to update the firmware on the NXT - DONE
  • Use the interface on the NXT to delete all programs and make room in the memory - DONE
  • Disable Enable External mode - DONE
  • If your model contains a Model block, open the Model block and configure the the referenced model to have identical settings as the top model. (Use Tools > Run on Target Hardware > Prepare to Run (or Options).
  • Follow the tips and instructions in Exchange Data Between Two NXT Bricks
Please let me know if the issue isn't resolved.

Sign in to comment.


Takashi Chikamasa
Takashi Chikamasa on 5 Sep 2012
Hi Frederik. The "region ram is full" error is happened due to larger size of the program to be downloaded into the NXT. In case of NXT with RoTH use case, maximum size of an application needs to be smaller than 64Kbites which includes RAM and ROM. I am not sure about your model which uses MPC. However, I guess MPC algorithm consumes larger footprint even it was simple in Simulink. In case of NXT with RoTH, nxtOSEK is used as runtime environment and it has nothing with BrickOS which was used for old LEGO MINDSTORMS (yellow brick one).
Takashi

  1 Comment

Alexander
Alexander on 7 Jun 2013
Dear Rolfe,
I am working now on my Thesis in Germany and have to programm a Lego NXT made roboter with the VU-LRT Toolbox. I made already some schorts programm but they didn't work. May be you could help me. I received always the same error:
1-The call to lrt_make_rtw_hook, during the after_make hook generated the following error: Build failed during Make all
The build process will terminate as a result.
2-Build failed during Make all
3-Parsing successful for chart: "Messwerte/Packet"(#21)
Please could you help me Thank you for all
Alex

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by