Open 0x0fe opened 1 year ago
Don't check 'Reset and Run',and don't check Debug tab 'Reset after Connect'; click Start/Stop Debug Session(F5) button to execute Dbg_Init.ini, let register point to program in SDRAM. Then click run button to full speed run program
I will put some demo pictures later
actually that is what i did, and most of time it crashed (hangs and then lost connection with target) when i start the debug sessions, i suspect my Jlink OB is too recent compared to my Keil uvision or something. I tested maybe 100 times and i was able to reach my breakpoint only once or twice.
What works great is the flashing to SDRAM, no problem, this works every time.
but what never works is the start debug/run at full speed. i tried at all speeds down to 200KHz.
Do you know how to load Dbg_init.ini directly after the flashing, from Keil or manually using Jlink commander? I tried to add the Dbg_init.ini in the flash menu command, but it did not seem to work.
I feel i am very close to running, the only problematic step is pointing to sdram and starting up the CPU.
I dont really care about step debug, all i need is to be able to flash the ram and run, i can use the uart to debug.
What is more, the uFelisFlash utility doesnt work with my Jlink OB, i think the Jlink-OB firmware may be too recent compared to the Jlink.exe they embedded into ugelisflah.exe
I wish i could replace this tool by a script, but i am not 100% sure what they do, i suspect it loads the loader in memory, and then somehow pass the datas to the loader which writes to the flash itself. IT is sad they do not document the process.
That is my attemps with Jlink command so far, but i still dont know how to : load symbol file of *.axf, Setup Stack Pointer and Setup Program Counter.
connect //connect
CORTEX-M4 //device
s //SWD interface
2000 //2MHz
h //halt
loadbin ugelis_demo.bin, 0x00010000, 0xE290 //load binary to sdram
w2 0x1ffff0a8 , 0xfffffba6 //clk trim
w2 0x1ffff0ac , 0xffc4ffff //clk trim
w2 0x1ffff0b0 , 0xff3fffff //clk trim
//LOAD %L INCREMENTAL //load symbol file of *.axf----this, i dont know
w2 0xE0042020, 0x00000003 //Sdram mapping 0xC0000000 -> 0x00000000
//SP = _RDWORD(0xC0010000); //Setup Stack Pointer----this i dont know
//PC = _RDWORD(0xC0010004); //Setup Program Counter----this i dont know
w2 0x4003EC00, 0x1ACCE551 //disable watchdog
w2 0x4003E008, 0x00000000 //disable watchdog
g //run
I don't know how to write a correct MDK debug script (Dbg_init.ini). Maybe you can try the oldest version SDK 1.0, https://github.com/BPI-SINOVOIP/BPI-EAI80-bsp/releases/tag/v1.0, I used this version (BPI-EAI80-bsp-1.0, see my README.md) with little modifications
Actually I used too long time to think how to run this board, so i don't recommend it (I'm an amateur). I prefer use stm32f4 or stm32h7 with large SRAM or SDRAM
yes i know what you mean, the tool of GREE sucks, and there is not enough information to djsut the tools by ourselves.
I don't know how to write a correct MDK debug script (Dbg_init.ini). Maybe you can try the oldest version SDK 1.0, https://github.com/BPI-SINOVOIP/BPI-EAI80-bsp/releases/tag/v1.0, I used this version (BPI-EAI80-bsp-1.0, see my README.md) with little modifications
oh, good idea
i see you JLink is differnet version than mine, maybe it works better
i tried the older release (1.0) same problem, and the flash tool doesnt work either. I also tried with a large JLink (not OB) same problem. this is really frustrating because that chip is great, sure you can use an STM32, but that is not the same computing power at all, what is great on the EAI80 is the dual core M4 + NPU, that is perfect for a small AI camera module at vey low price. That is the reason why i dont give it up yet.
OK, I will check this problem again on weekend
Thanks, that is very kind. Meanwhile i have downgraded the JLink DLL and software to 6.32 (same as yours) and for the first time i havebeen able to step run the code, and blink the led with two breakpoints.
SO hopefully the run to SDRAM method can work now, and my next concern will be how to flash into the external flash, because both ugelis flash tool are not working on my system. So i haveto figure out how to flash to the external flash from Keil, presumably with the FLM file.
i can confirm, the run in SDRAM is working fine now, no more crash, and i can run the code at full speed. So the next concern is to get the UgelisFlashTool to work, or find a way to flash the SPI FLASH via Keil using the provided FLM files
could you show me your model of Jlink OB? i noticed it is the V7.0 which is really older than the one i use, i would like to purcahse the same model so i can have a chance to run the flasher tool.
I am busy recently, I need some days to check this
I setup the project to write firmware to F6721B SDRAM 8M Address 0x00, like this. My test project is uploaded to https://github.com/weimingtom/eai80_hello
Before I press the debugging button, MDK5 will upload the firmware, or I manually press the download button. It is necessary.
I tested three fake J-Link (don't ask me why fake) are all OK. If no SW pot is shown, try to exit MDK5, delete the file JLinkSettings.ini, open the project setting dialog, see J-Link setup, then choose Unspecified, Cortex-M4 (Actually it is Cortex-M4F).
big j-link v9:
J-Link V9 compiled Oct 25 2018 11:46:07
small j-link v9.6:
J-Link V9 compiled May 7 2021 16:26:12
j-link ob:
J-Link ARM-OB STM32 compiled Aug 22 2012 19:52:04
If you modify F6721B SDRAM 8M Address (see before J-Link setup dialog), please first backup your prorject. I find the projects in BPI EAI80 BSP SDK are difference in project setup and Dbg_Init.ini. I also don't know if it is debugging in RAM (I find the board is not working after reconnecting power, so I think the flash is not written). Please see 4.EAISeries_SDK_UserGuide.pdf, https://forum.banana-pi.org/t/bpi-eai80-aiot-board-eaiseries-sdk-usergride/11573
Hi, thank you very much for the extensive checks. That is very useful. on my side what i discovered is that, if using JLink OB (not the big Jlink) then only the old hardware / firmware (V7) will work correctly with uGelisFlash.exe, in fact even in Keil uvision, when using more recent Jlink OB it is always crashing/failing at the time of starting the debug session. I think you got lucky with your hardware version which append to work fine.
also don't know if it is debugging in RAM (I find the board is not working after reconnecting power, so I think the flash is not written)
Definitely SDRAM, with the current examples firmware is flashed to SDRAM only, by Keil, and then when we start the debug session it runs the Dbg_init.ini script which remaps sdram, set stack pointer and set program counter. Then when we press on run button it starts the internal CPU state machine (go command in jlink). I managed to write a Jlink script to do this without starting a debug session, alas PC and SP addresses have to be dynamically modified before starting, and Jlink script cannot store any variable. So the script is not fully functional, the PC and SP address would need to be updated everytime the firmware is recompiled.
Gree also provided the FLM files in \KelisSDK\ugelis\tools\kei to burn firmware to flash directly from Keil uvision,but no example project with the correct setup, so far i did not manage to set the target options correctly to flash into external flash directly from Keil.
eai80_start_from_sdram_jlink.zip
At least i found how to make uGelisFlash.exe work, by using JLink OB hardware version 7.
Hi, i am doing the same as you tell for running code from ram but i cannot get it to work, did you simply start the debug session and then clic the "run" button?