-
Notifications
You must be signed in to change notification settings - Fork 72
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
rboot + uart #52
Comments
Can you give me more information on the error? Maybe the build log so I can get an idea of what's failing. Being able to see the code would probably help too, if that's an option. |
Thanks for the swift response here! In essence, what I was trying to do is to re-use/copy the SDK's driver library into rboot, such that I could start using the UART functions. This, however, resulted in a nice deepdive into Espressif's wonderful Makefiles. Anyway, here's my (current) plan - making use of (a copy of) the ESP NONOS 3.0 SDK's driver library, like I did for the main application (which works):
In
And here's the first part of the compiler output:
Do you have any idea on:
Again, I appreciate your time spent on this one 👍🙏 |
rBoot cannot be linked against the sdk library or, consequently, make use of any normal sdk functions or code. A bootloader if not a normal app, it is a tiny bit of baremetal code, that can only use simple rom based functions (or it's own code). To link it against the SDK library it would go from <1k to hundreds and, more importantly, would be unable to chain load a user rom. |
Indeed, bootloaders are typically small and non-sophisticated. I just hoped that “just” adding UART functionality wouldn’t crank up its total size too much. Anyway, looking forward, I guess I’d go for the following setup then:
Thoughts? |
You could (probably) still use uart in rBoot, after all it is able to print to the serial port. But you'd need to work out how to do that, and couldn't use the SDK functions. If you decompile the parts of the sdk that do the functions you want to use you may be able to see what lower level calls are made and replicate these in rBoot. In theory basic serial interaction shouldn't be too complex (compared with wifi, for example), but as nothing at this level is documented it might take a lot of figuring out. Your way of having another rom specifically for performing the update is a reasonable option. You could also use the gpio boot option to have a button to force booting of this "recovery" rom. |
You could look at the esptool.py stub flasher code, here. AFAIK it is not compiled against the SDK and just uses the definitions from rom_functions.h. Also -just my 2 cents- I'd recommend against multiple stages of bootloader. It complicates everything. Just pack it into a single rboot. |
Good tip, that looks about right. |
Thanks for the great thoughts here @raburton and @someburner! I'm following your recommendations on trying to get UART working in rboot the same way as the stub_flasher does. Now, I've spent a bit of time mimicking what happens in stub_flasher.c (especially from this location).
I've dived into where it goes wrong, and it goes wrong with the following calls (regardless in what order):
I assume it has something to do with the linking and memory mapping, so here's the map for, e.g., ets_isr_attach, as defined in the rom.ld file:
The app.ld file is as follows:
Current generated rboot.bin is 2.3K large. Thoughts? |
There is no flash memory mapping here, so you need to keep your code in the iram segment. If it's trying to run code from 0x40240010 then that code must have found it's way into the wrong segment. |
Awesome, thanks for the hint; I had to remove Now I'm trying to remove the need / get a similar workaround for functions |
There are some memory management functions in rom, I don't remember using them but I imagine they work pretty much as you'd expect them to. See: https://github.com/raburton/rboot/blob/master/eagle.rom.addr.v6.ld#L190 |
Tad of a late reply here, but thanks again for the hints! Now, as rboot.c has grown a bit too much, I’d like to split the code into multiple source files, i.e.., add my own uart.c and uart.h to it as well. However, I only know some basic Makefile stuff and I do not fully understand what your esptool2 is doing, so, perhaps you could help me here @raburton? |
I can't really give you a makefile tutorial, but as a starter try creating some additional targets like the one for $(RBOOT_BUILD_BASE)/rboot.o:, for your new uart files. |
Thanks for the guidance (and notes on esptool2). I misunderstood the usage of |
Hi,
First of all; many thanks for releasing rboot!
I'm trying to get (ESP8266_NONOS_SDK-3.0) UART working on rboot, as I'd like to define how to boot depending on what's coming in on UART. However, I'm a bit puzzled on how to achieve that in combination with your Makefile and esptool2. I keep on hitting on undefined reference errors when compiling, so I guess it's something to do with linking the objects together somehow. As I'm not a Makefile/compiler master, I would appreciate your thoughts on this, i.e., how would you approach this?
The text was updated successfully, but these errors were encountered: