My task for last week was to implement CORS protocol for the HTTP server on FreeRTOS with the new boards. To briefly explain, when accessing an HTTP website (server) your browser (client) is sending a request to the server (GET request) asking for data. If you’re on chrome hit F12 go onto network tab and refresh the page. Click any item to view the request method which will probably be GET.

The PIC32 will be the server listening for the following requests as part of the CORS protocol:

  • OPTIONS
  • DELETE
  • PUT
  • HEAD

OPTIONS is the preflight command. If permission is given, other requests can be sent. The purpose of the other operations is erasing, transmitting and verifying the firmware for the FPGA/Flash depending on the sequence.

When the server processes the request, it responds with the appropriate header and status code. To test the CORS server I used the “curl” command.

$ curl -vki -X <command> <host>

For example, to send a bit-stream to the server:

$ curl -vki -X PUT -data–binary @filename.bin <host>

Anyways, for next week I’ve got minor fixes to do on the state machine of the CORS server, as well as learning how to utilize the PIC’s flash. I will also have to implement HOTP and SSL for security.