doom13 0 July 28, 2020 Posted July 28, 2020 · Report post Приветствую. При старте программы MicroBlaze и остановке на main() наблюдаю непонятное содержимое в стеке вызовов. Может кто сталкивался с подобным поведением и с чем оно связано? Думал это связано с С++ проектом, но нашёл аналогичную проблему и для проекта на С тут. Использую Vivado/SDK 2018.2, думал ситуация изменится при использовании Vitis 2020.1, но не помогло. Quote Share this post Link to post Share on other sites More sharing options...
Strob 0 July 28, 2020 Posted July 28, 2020 · Report post А если в настройках Debug configuration поставить галочку Reset entire system, результат какой будет? Quote Share this post Link to post Share on other sites More sharing options...
doom13 0 July 29, 2020 Posted July 29, 2020 · Report post 12 hours ago, Strob said: А если в настройках Debug configuration поставить галочку Reset entire system, результат какой будет? Не меняется ничего. Quote Share this post Link to post Share on other sites More sharing options...
doom13 0 July 29, 2020 Posted July 29, 2020 · Report post Нашёл такую особенность, если в настройках компилятора установить Debug Level -> None (-g0), то картинка меняется. Баг SDK??? Quote Share this post Link to post Share on other sites More sharing options...
doom13 0 July 31, 2020 Posted July 31, 2020 · Report post Пока проблему вижу в Xilinx SDK (может быть можно как-то настроить?). В настройках проекта в дефолтном состоянии установлены флаги для компилятора -ffunction-sections -fdata-sections и линкера --gc-sections (Enable garbage collector), которые и приводят к данной проблеме. Для кода int TestFunction(int x1, int x2); int main() { while(1) { } return 0; } int TestFunction(int x1, int x2) { return x1 + x2; } c установленными в опциях проекта галками Enable garbage collector получаем следующее в elf-файле Disassembly of section .vectors.reset: 00000000 <_start>: } return 0; } int TestFunction(int x1, int x2) { 0: b0000000 imm 0 4: b8080050 brai 80 // 50 <_start1> Disassembly of section .vectors.sw_exception: 00000008 <_vector_sw_exception>: 8: b0000000 imm 0 c: b808095c brai 2396 // 95c <_exception_handler> Disassembly of section .vectors.interrupt: 00000010 <_vector_interrupt>: 10: b0000000 imm 0 return x1 + x2; 14: b80809d0 brai 2512 // 9d0 <__interrupt_handler> Disassembly of section .vectors.hw_exception: 00000020 <_vector_hw_exception>: } 20: b0000000 imm 0 24: b80802f0 brai 752 // 2f0 <_hw_exception_handler> Disassembly of section .text: если убрать разрешение Enable garbage collector, то всё сразу круто (за исключением размера бинарника) Disassembly of section .vectors.reset: 00000000 <_start>: 0: b0000000 imm 0 4: b8080050 brai 80 // 50 <_start1> Disassembly of section .vectors.sw_exception: 00000008 <_vector_sw_exception>: 8: b0000000 imm 0 c: b808099c brai 2460 // 99c <_exception_handler> Disassembly of section .vectors.interrupt: 00000010 <_vector_interrupt>: 10: b0000000 imm 0 14: b8080a00 brai 2560 // a00 <__interrupt_handler> Disassembly of section .vectors.hw_exception: 00000020 <_vector_hw_exception>: 20: b0000000 imm 0 24: b8080330 brai 816 // 330 <_hw_exception_handler> Disassembly of section .text: Криво сформированный elf-файл и приводит к тому, что SDK (если в Debug Configurations поставить галку Stop at program entry) отображает выполнение кода, который не должен был выполняться (реально выполняется startup sequence crt0.S). Как исправить - вопрос открытый. Quote Share this post Link to post Share on other sites More sharing options...