I've done some projects including bootloader for PIC microcontrollers. But all these are done by modifying official microchip codes. Also want to share official drivers and softwares. I want to share this open. Is this possible? Is there any legal problems by doing this?
IANAL. Best to contact Microchip. That said, in the file "Microchip Application Solutions Users Agreement.pdf", which accompanies one of the many Microchip source libraries I have on my system, section 1(b)(i)(1) (Software License Grant) states:
Licensee may use, modify, copy, and distribute the Software identified in the subheading of this Section 1(b)(i) when such Software is embedded in a Microchip Product that is either integrated into Licensee Product or Third Party Product pursuant to Section 1(d) below.
The part that says you can distribute would, it seems to me, allow you to publish the software on your site, i.e. as one means of distributing it.
However, the tricky party here is the phrase "when such Software is embedded in a Microchip Product that is either integrated into Licensee Product". To me, this means any such source code you want to put on your site, you need to be actually using in a product.
Since you are probably not producing any real products (maybe you are), then I would think just using the source in one of your own projects would count. But you can't just through up all of their source code on your site willy nilly whether you are using it yourself or not.
So check the individual license file that comes with each of the libraries you want to publish source from, and check if they include verbiage such as that above.
Microchip.com, section About Us » Legal Information » Copyright Usage Guidelines:
If you would like to reproduce, translate, and/or reprint Microchip copyrighted material for commercial purposes you must request Microchip’s written permission by following the 3-step process described below. Microchip’s written permission is not required for personal use or educational (non-profit) use of copyrighted material.
So it seems like you'll have to contact them, but if your usage is strictly personal or educational, you don't need to (but it would still be good to do so, to be sure). See the article itself for the full text.
Of course, some code examples (like the small ones in datasheets on how to set pins, etc.) are too small to be copyrighted.