nekromant / antares

antares uC buildsystem
210 stars 31 forks source link

Would like to ask a question about licensing #73

Closed dhylands closed 8 years ago

dhylands commented 9 years ago

Hi,

I'd like to include https://github.com/nekromant/antares/blob/master/include/lib/stlinky.h and https://github.com/nekromant/antares/blob/master/src/lib/stlinky/stlinky.c into the MicroPython project https://github.com/micropython/micropython which is licensed under the MIT license.

So this is a request to have those 2 files licensed under MIT (instead of GPLv2) or to have the author grant MicroPython a license to use those 2 files under the MIT license.

Since I'd like to copy the files into the micropython source tree, I would also like to give attribution back to the original source (i.e. this repository) by adding an appropriate comment block into the 2 files.

Thanks for your time.

nekromant commented 9 years ago

stlinky has been written by me, so it will be no problem to dual-license these under both GPL and MIT. I'll add license headers ASAP and would ask you to leave them there with the link to original project (and hopefully contribute any useful changes back to antares). And can it wait till weekend?

dhylands commented 9 years ago

No rush, and I'd be more than happy to leave any/all headers intact.

As for changes, I do have a significant one to suggest, but it would require changes to st-term as well. Currently, the code have a tx buffer and an rx buffer, and the buffer count is either 0 or non-zero. So once a single character is written into the buffer, the writer has to wait until the buffer is empty before putting more data into the buffer.

The more traditional way to do this is to use a circular buffer with get and put indicies. The writer is the only one that modifies the put index, and the reader is the only one that modifies the get index. By making this change it allows the writer to continue adding characters to the buffer until its full. You can subtract the get index from the put index to determine the number of characters in the buffer (normally you need to always leave one space unused to allow distinguishing from buffer full versus buffer empty.

If you're willing to let the buffer always be a power of 2 in size, then you can play games with the get and put index where you don't have to wrap them, and you mask the index to get the correct value out of the buffer. This allows all of the buffer to be used. You can read more about this technique here: http://www.ganssle.com/tem/tem110.pdf starting with "A Fiendishly Clever Circular Buffer".

I've used this circular buffer technique in the past for multi-processor comms thru shared memory and it works quite well (in previous work I've done we had to ensure reader/writer were on different 16-byte regions of memory), but the idea is the same.

I'll wait until I get the basic stuff working before trying any changes. For some reason st-term is always reading back 0x00000080 for all sram locations (but st-flash seems to be working fine). I'll need to figure out what's going on there.

nekromant commented 9 years ago

Yep, I know what a cb is and I know this quite ugly ;) This stuff was initially designed as a proof-of-concept a while ago and hacked altogether in less than an hour (including PR to st-utils).

dhylands commented 9 years ago

So if I comment out the call to stlink_run(sl) in st-term.c then it is able to read the RAM and find the shared buffer.

However, if I let it call stlink_run then it gets the same value from every memory location. I'm assuming that this is caused by some code running on the processor. Have you run into this before?

nekromant commented 9 years ago

Weird, it worked for me with no problem on stm32f10x discovery. I'll have to give it a try myself.

dhylands commented 9 years ago

I've been using an STM32F4 Discovery which has an F407 on it (just FYI).

nekromant commented 9 years ago

This one has a v2 stlink, that may be the difference that matters.

dhylands commented 9 years ago

My understanding is that all of the F4 discovery boards come with v2.

This page: http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/PF252419 says that it comes with STLINK/V2

nekromant commented 9 years ago

yep, I'll have to give stlinky a spin myself on F4 discovery.

Windfisch commented 8 years ago

Hey nekromant,

could you please add the License headers to at least the stlinky.* files? (may I suggest a BSD or MIT license? GPL causes too much pain for embedded stuff, unfortunately)

I'd love to use them, but I cannot find any information about the licensing in the whole repo :|

nekromant commented 8 years ago

Yep, will do tomorrow. MIT won't hurt. Please note, that this won't influence other components of antares, since a lot of are GPLv2 or even GPLv2 (+obdev exeption)

Windfisch commented 8 years ago

ping

nekromant commented 8 years ago

Sorry for the delay, I have a little bit of personal hell going on, I've added the license header to the file (experimental branch)