About the license for BSP

I downloaded the FreedomStudio, but found no license file in the HiFive examples.
Can I use the BSP code in GPLv2 software?

Entire freedom-e-sdk seems to be Apache 2? So, yes. IANAL.

I don’t believe so (obligatory disclaimer: IANAL either). According to both the FSF and the ASF you’d only be able to use Apache2 licensed code with the GPLv3. Something about patent licensing, which IIRC is why SiFive went with Apache2 in the first place.

Additionally, the compatibility is one-way. If you made useful modifications to the SDK in your derived work you wouldn’t be able to upstream them which would be a great shame for the community at large.

So the BSP license is only compatible with GPLv3?
One of my projects can use these codes, https://github.com/versaloon/vsf
It implements a generic hal for different MCUs, so the application layer is exactly the same for different hardwares. so VSF can add support to FE310.

But some other GPLv2 licensed software can not use it.

I looked through your code repo and noticed that you’d included files taken directly from ARM’s CMSIS package, and you intend the same with items from the Freedom SDK (platform.h, encoding.h etc)?

The better way to handle this sort of inter-dependence is to link the external projects as submodules, just as the (Apache2 licensed) Freedom SDK does with (GPLv2 licensed) OpenOCD and gcc. As well as resolving your license woes it’ll make it easier to keep your repo up to date as you can just change the link reference, rather than manually patching changes.

Some old drivers uses CMSIS, but the CMSIS files are not used any more, I have removed them.

For the Freedom SDK, I don’t think it’s suitable for MCU applications, I will rewrite them all, but some MACROs for registers are useful. Just like other MCU drivers in VSF, I just use the MACROs for registers from the chip vendor, not use their libraries.